<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<title>API: dom   Dom.js  (YUI Library)</title>

	<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" />
	<link rel="stylesheet" type="text/css" href="assets/api.css" />

    <script type="text/javascript" src="assets/api-js"></script>
    <script type="text/javascript" src="assets/ac-js"></script>
</head>

<body id="yahoo-com">

<div id="doc3" class="yui-t2">
	<div id="hd">
        <h1><a href="http://developer.yahoo.com/yui/" title="Yahoo! UI Library">Yahoo! UI Library</a></h1>
        <h3>dom&nbsp; <span class="subtitle">2.7.0</span></h3>
        <a href="./index.html" title="Yahoo! UI Library">Yahoo! UI Library</a> 
            &gt; <a href="./module_dom.html" title="dom">dom</a>
                
                 &gt; Dom.js (source view) 
        <form onsubmit="return false">
            <div id="propertysearch">
                Search: <input autocomplete="off" id="searchinput" />
                <div id="searchresults">
                    &nbsp;
                </div>
            </div>
        </form>
	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">
            <form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
                <fieldset>
                    <legend>Filters</legend>
                <span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
                <span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
                <span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
                </fieldset>
            </form>

                    <div id="srcout">
                        <style>
                            #doc3 .classopts { display:none; }
                        </style>
<div class="highlight" ><pre><span class="c">/**</span>
<span class="c"> * The dom module provides helper methods for manipulating Dom elements.</span>
<span class="c"> * @module dom</span>
<span class="c"> *</span>
<span class="c"> */</span>

<span class="o">(</span><span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">env</span><span class="o">.</span><span class="nx">_id_counter</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">env</span><span class="o">.</span><span class="nx">_id_counter</span> <span class="o">||</span> <span class="m">0</span><span class="o">;</span>     <span class="c">// for use with generateId (global to save state if Dom is overwritten)</span>
<span class="c"></span>
        <span class="c">// internal shorthand</span>
<span class="c"></span>    <span class="k">var</span> <span class="nx">Y</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">,</span>
        <span class="nx">lang</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">,</span>
        <span class="nx">UA</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">env</span><span class="o">.</span><span class="nx">ua</span><span class="o">,</span>
        <span class="nx">trim</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">trim</span><span class="o">,</span>
        <span class="nx">propertyCache</span> <span class="o">=</span> <span class="o">{},</span> <span class="c">// for faster hyphen converts</span>
<span class="c"></span>        <span class="nx">reCache</span> <span class="o">=</span> <span class="o">{},</span> <span class="c">// cache className regexes</span>
<span class="c"></span>        <span class="nx">RE_TABLE</span> <span class="o">=</span> <span class="sr">/^t(?:able|d|h)$/i</span><span class="o">,</span> <span class="c">// for _calcBorders</span>
<span class="c"></span>        <span class="nx">RE_COLOR</span> <span class="o">=</span> <span class="sr">/color$/i</span><span class="o">,</span>

        <span class="c">// DOM aliases </span>
<span class="c"></span>        <span class="nb">document</span> <span class="o">=</span> <span class="nb">window</span><span class="o">.</span><span class="nb">document</span><span class="o">,</span>     
        <span class="nx">documentElement</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">documentElement</span><span class="o">,</span>

        <span class="c">// string constants</span>
<span class="c"></span>        <span class="nx">OWNER_DOCUMENT</span> <span class="o">=</span> <span class="s1">&#39;ownerDocument&#39;</span><span class="o">,</span>
        <span class="nx">DEFAULT_VIEW</span> <span class="o">=</span> <span class="s1">&#39;defaultView&#39;</span><span class="o">,</span>
        <span class="nx">DOCUMENT_ELEMENT</span> <span class="o">=</span> <span class="s1">&#39;documentElement&#39;</span><span class="o">,</span>
        <span class="nx">COMPAT_MODE</span> <span class="o">=</span> <span class="s1">&#39;compatMode&#39;</span><span class="o">,</span>
        <span class="nx">OFFSET_LEFT</span> <span class="o">=</span> <span class="s1">&#39;offsetLeft&#39;</span><span class="o">,</span>
        <span class="nx">OFFSET_TOP</span> <span class="o">=</span> <span class="s1">&#39;offsetTop&#39;</span><span class="o">,</span>
        <span class="nx">OFFSET_PARENT</span> <span class="o">=</span> <span class="s1">&#39;offsetParent&#39;</span><span class="o">,</span>
        <span class="nx">PARENT_NODE</span> <span class="o">=</span> <span class="s1">&#39;parentNode&#39;</span><span class="o">,</span>
        <span class="nx">NODE_TYPE</span> <span class="o">=</span> <span class="s1">&#39;nodeType&#39;</span><span class="o">,</span>
        <span class="nx">TAG_NAME</span> <span class="o">=</span> <span class="s1">&#39;tagName&#39;</span><span class="o">,</span>
        <span class="nx">SCROLL_LEFT</span> <span class="o">=</span> <span class="s1">&#39;scrollLeft&#39;</span><span class="o">,</span>
        <span class="nx">SCROLL_TOP</span> <span class="o">=</span> <span class="s1">&#39;scrollTop&#39;</span><span class="o">,</span>
        <span class="nx">GET_BOUNDING_CLIENT_RECT</span> <span class="o">=</span> <span class="s1">&#39;getBoundingClientRect&#39;</span><span class="o">,</span>
        <span class="nx">GET_COMPUTED_STYLE</span> <span class="o">=</span> <span class="s1">&#39;getComputedStyle&#39;</span><span class="o">,</span>
        <span class="nx">CURRENT_STYLE</span> <span class="o">=</span> <span class="s1">&#39;currentStyle&#39;</span><span class="o">,</span>
        <span class="nx">CSS1_COMPAT</span> <span class="o">=</span> <span class="s1">&#39;CSS1Compat&#39;</span><span class="o">,</span>
        <span class="nx">_BACK_COMPAT</span> <span class="o">=</span> <span class="s1">&#39;BackCompat&#39;</span><span class="o">,</span>
        <span class="nx">_CLASS</span> <span class="o">=</span> <span class="s1">&#39;class&#39;</span><span class="o">,</span> <span class="c">// underscore due to reserved word</span>
<span class="c"></span>        <span class="nx">CLASS_NAME</span> <span class="o">=</span> <span class="s1">&#39;className&#39;</span><span class="o">,</span>
        <span class="nx">EMPTY</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="o">,</span>
        <span class="nx">SPACE</span> <span class="o">=</span> <span class="s1">&#39; &#39;</span><span class="o">,</span>
        <span class="nx">C_START</span> <span class="o">=</span> <span class="s1">&#39;(?:^|\\s)&#39;</span><span class="o">,</span>
        <span class="nx">C_END</span> <span class="o">=</span> <span class="s1">&#39;(?= |$)&#39;</span><span class="o">,</span>
        <span class="nx">G</span> <span class="o">=</span> <span class="s1">&#39;g&#39;</span><span class="o">,</span>
        <span class="nx">POSITION</span> <span class="o">=</span> <span class="s1">&#39;position&#39;</span><span class="o">,</span>
        <span class="nx">FIXED</span> <span class="o">=</span> <span class="s1">&#39;fixed&#39;</span><span class="o">,</span>
        <span class="nx">RELATIVE</span> <span class="o">=</span> <span class="s1">&#39;relative&#39;</span><span class="o">,</span>
        <span class="nx">LEFT</span> <span class="o">=</span> <span class="s1">&#39;left&#39;</span><span class="o">,</span>
        <span class="nx">TOP</span> <span class="o">=</span> <span class="s1">&#39;top&#39;</span><span class="o">,</span>
        <span class="nx">MEDIUM</span> <span class="o">=</span> <span class="s1">&#39;medium&#39;</span><span class="o">,</span>
        <span class="nx">BORDER_LEFT_WIDTH</span> <span class="o">=</span> <span class="s1">&#39;borderLeftWidth&#39;</span><span class="o">,</span>
        <span class="nx">BORDER_TOP_WIDTH</span> <span class="o">=</span> <span class="s1">&#39;borderTopWidth&#39;</span><span class="o">,</span>
    
    <span class="c">// brower detection</span>
<span class="c"></span>        <span class="nx">isOpera</span> <span class="o">=</span> <span class="nx">UA</span><span class="o">.</span><span class="nx">opera</span><span class="o">,</span>
        <span class="nx">isSafari</span> <span class="o">=</span> <span class="nx">UA</span><span class="o">.</span><span class="nx">webkit</span><span class="o">,</span> 
        <span class="nx">isGecko</span> <span class="o">=</span> <span class="nx">UA</span><span class="o">.</span><span class="nx">gecko</span><span class="o">,</span> 
        <span class="nx">isIE</span> <span class="o">=</span> <span class="nx">UA</span><span class="o">.</span><span class="nx">ie</span><span class="o">;</span> 
    
    <span class="c">/**</span>
<span class="c">     * Provides helper methods for DOM elements.</span>
<span class="c">     * @namespace YAHOO.util</span>
<span class="c">     * @class Dom</span>
<span class="c">     * @requires yahoo, event</span>
<span class="c">     */</span>
    <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span> <span class="o">=</span> <span class="o">{</span>
        <span class="nx">CUSTOM_ATTRIBUTES</span><span class="o">:</span> <span class="o">(!</span><span class="nx">documentElement</span><span class="o">.</span><span class="nx">hasAttribute</span><span class="o">)</span> <span class="o">?</span> <span class="o">{</span> <span class="c">// IE &lt; 8</span>
<span class="c"></span>            <span class="s1">&#39;for&#39;</span><span class="o">:</span> <span class="s1">&#39;htmlFor&#39;</span><span class="o">,</span>
            <span class="s1">&#39;class&#39;</span><span class="o">:</span> <span class="nx">CLASS_NAME</span>
        <span class="o">}</span> <span class="o">:</span> <span class="o">{</span> <span class="c">// w3c</span>
<span class="c"></span>            <span class="s1">&#39;htmlFor&#39;</span><span class="o">:</span> <span class="s1">&#39;for&#39;</span><span class="o">,</span>
            <span class="s1">&#39;className&#39;</span><span class="o">:</span> <span class="nx">_CLASS</span>
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Returns an HTMLElement reference.</span>
<span class="c">         * @method get</span>
<span class="c">         * @param {String | HTMLElement |Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.</span>
<span class="c">         * @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements.</span>
<span class="c">         */</span>
        <span class="nx">get</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">id</span><span class="o">,</span> <span class="nx">nodes</span><span class="o">,</span> <span class="nx">c</span><span class="o">,</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">len</span><span class="o">;</span>

            <span class="k">if</span> <span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span><span class="nx">el</span><span class="o">[</span><span class="nx">NODE_TYPE</span><span class="o">]</span> <span class="o">||</span> <span class="nx">el</span><span class="o">.</span><span class="nx">item</span><span class="o">)</span> <span class="o">{</span> <span class="c">// Node, or NodeList</span>
<span class="c"></span>                    <span class="k">return</span> <span class="nx">el</span><span class="o">;</span>
                <span class="o">}</span>

                <span class="k">if</span> <span class="o">(</span><span class="k">typeof</span> <span class="nx">el</span> <span class="o">===</span> <span class="s1">&#39;string&#39;</span><span class="o">)</span> <span class="o">{</span> <span class="c">// id</span>
<span class="c"></span>                    <span class="nx">id</span> <span class="o">=</span> <span class="nx">el</span><span class="o">;</span>
                    <span class="nx">el</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">getElementById</span><span class="o">(</span><span class="nx">el</span><span class="o">);</span>
                    <span class="k">if</span> <span class="o">(</span><span class="nx">el</span> <span class="o">&amp;&amp;</span> <span class="nx">el</span><span class="o">.</span><span class="nx">id</span> <span class="o">===</span> <span class="nx">id</span><span class="o">)</span> <span class="o">{</span> <span class="c">// IE: avoid false match on &quot;name&quot; attribute</span>
<span class="c"></span>                    <span class="k">return</span> <span class="nx">el</span><span class="o">;</span>
                    <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">el</span> <span class="o">&amp;&amp;</span> <span class="nb">document</span><span class="o">.</span><span class="nx">all</span><span class="o">)</span> <span class="o">{</span> <span class="c">// filter by name</span>
<span class="c"></span>                        <span class="nx">el</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
                        <span class="nx">nodes</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">all</span><span class="o">[</span><span class="nx">id</span><span class="o">];</span>
                        <span class="k">for</span> <span class="o">(</span><span class="nx">i</span> <span class="o">=</span> <span class="m">0</span><span class="o">,</span> <span class="nx">len</span> <span class="o">=</span> <span class="nx">nodes</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">len</span><span class="o">;</span> <span class="o">++</span><span class="nx">i</span><span class="o">)</span> <span class="o">{</span>
                            <span class="k">if</span> <span class="o">(</span><span class="nx">nodes</span><span class="o">[</span><span class="nx">i</span><span class="o">].</span><span class="nx">id</span> <span class="o">===</span> <span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
                                <span class="k">return</span> <span class="nx">nodes</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
                            <span class="o">}</span>
                        <span class="o">}</span>
                    <span class="o">}</span>
                    <span class="k">return</span> <span class="nx">el</span><span class="o">;</span>
                <span class="o">}</span>
                
                <span class="k">if</span> <span class="o">(</span><span class="nx">el</span><span class="o">.</span><span class="nx">DOM_EVENTS</span><span class="o">)</span> <span class="o">{</span> <span class="c">// YAHOO.util.Element</span>
<span class="c"></span>                    <span class="nx">el</span> <span class="o">=</span> <span class="nx">el</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">);</span>
                <span class="o">}</span>

                <span class="k">if</span> <span class="o">(</span><span class="s1">&#39;length&#39;</span> <span class="k">in</span> <span class="nx">el</span><span class="o">)</span> <span class="o">{</span> <span class="c">// array-like </span>
<span class="c"></span>                    <span class="nx">c</span> <span class="o">=</span> <span class="o">[];</span>
                    <span class="k">for</span> <span class="o">(</span><span class="nx">i</span> <span class="o">=</span> <span class="m">0</span><span class="o">,</span> <span class="nx">len</span> <span class="o">=</span> <span class="nx">el</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">len</span><span class="o">;</span> <span class="o">++</span><span class="nx">i</span><span class="o">)</span> <span class="o">{</span>
                        <span class="nx">c</span><span class="o">[</span><span class="nx">c</span><span class="o">.</span><span class="nx">length</span><span class="o">]</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">el</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
                    <span class="o">}</span>
                    
                    <span class="k">return</span> <span class="nx">c</span><span class="o">;</span>
                <span class="o">}</span>

                <span class="k">return</span> <span class="nx">el</span><span class="o">;</span> <span class="c">// some other object, just pass it back</span>
<span class="c"></span>            <span class="o">}</span>

            <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
        <span class="o">},</span>
    
        <span class="nx">getComputedStyle</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">property</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">if</span> <span class="o">(</span><span class="nb">window</span><span class="o">[</span><span class="nx">GET_COMPUTED_STYLE</span><span class="o">])</span> <span class="o">{</span>
                <span class="k">return</span> <span class="nx">el</span><span class="o">[</span><span class="nx">OWNER_DOCUMENT</span><span class="o">][</span><span class="nx">DEFAULT_VIEW</span><span class="o">][</span><span class="nx">GET_COMPUTED_STYLE</span><span class="o">](</span><span class="nx">el</span><span class="o">,</span> <span class="kc">null</span><span class="o">)[</span><span class="nx">property</span><span class="o">];</span>
            <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">el</span><span class="o">[</span><span class="nx">CURRENT_STYLE</span><span class="o">])</span> <span class="o">{</span>
                <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">IE_ComputedStyle</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">property</span><span class="o">);</span>
            <span class="o">}</span>
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Normalizes currentStyle and ComputedStyle.</span>
<span class="c">         * @method getStyle</span>
<span class="c">         * @param {String | HTMLElement |Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.</span>
<span class="c">         * @param {String} property The style property whose value is returned.</span>
<span class="c">         * @return {String | Array} The current value of the style property for the element(s).</span>
<span class="c">         */</span>
        <span class="nx">getStyle</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">property</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_getStyle</span><span class="o">,</span> <span class="nx">property</span><span class="o">);</span>
        <span class="o">},</span>

        <span class="c">// branching at load instead of runtime</span>
<span class="c"></span>        <span class="nx">_getStyle</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
            <span class="k">if</span> <span class="o">(</span><span class="nb">window</span><span class="o">[</span><span class="nx">GET_COMPUTED_STYLE</span><span class="o">])</span> <span class="o">{</span> <span class="c">// W3C DOM method</span>
<span class="c"></span>                <span class="k">return</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">property</span><span class="o">)</span> <span class="o">{</span>
                    <span class="nx">property</span> <span class="o">=</span> <span class="o">(</span><span class="nx">property</span> <span class="o">===</span> <span class="s1">&#39;float&#39;</span><span class="o">)</span> <span class="o">?</span> <span class="nx">property</span> <span class="o">=</span> <span class="s1">&#39;cssFloat&#39;</span> <span class="o">:</span>
                            <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_toCamel</span><span class="o">(</span><span class="nx">property</span><span class="o">);</span>

                    <span class="k">var</span> <span class="nx">value</span> <span class="o">=</span> <span class="nx">el</span><span class="o">.</span><span class="nx">style</span><span class="o">[</span><span class="nx">property</span><span class="o">],</span>
                        <span class="nx">computed</span><span class="o">;</span>
                    
                    <span class="k">if</span> <span class="o">(!</span><span class="nx">value</span><span class="o">)</span> <span class="o">{</span>
                        <span class="nx">computed</span> <span class="o">=</span> <span class="nx">el</span><span class="o">[</span><span class="nx">OWNER_DOCUMENT</span><span class="o">][</span><span class="nx">DEFAULT_VIEW</span><span class="o">][</span><span class="nx">GET_COMPUTED_STYLE</span><span class="o">](</span><span class="nx">el</span><span class="o">,</span> <span class="kc">null</span><span class="o">);</span>
                        <span class="k">if</span> <span class="o">(</span><span class="nx">computed</span><span class="o">)</span> <span class="o">{</span> <span class="c">// test computed before touching for safari</span>
<span class="c"></span>                            <span class="nx">value</span> <span class="o">=</span> <span class="nx">computed</span><span class="o">[</span><span class="nx">property</span><span class="o">];</span>
                        <span class="o">}</span>
                    <span class="o">}</span>
                    
                    <span class="k">return</span> <span class="nx">value</span><span class="o">;</span>
                <span class="o">};</span>
            <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">documentElement</span><span class="o">[</span><span class="nx">CURRENT_STYLE</span><span class="o">])</span> <span class="o">{</span>
                <span class="k">return</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">property</span><span class="o">)</span> <span class="o">{</span>                         
                    <span class="k">var</span> <span class="nx">value</span><span class="o">;</span>

                    <span class="nx">switch</span><span class="o">(</span><span class="nx">property</span><span class="o">)</span> <span class="o">{</span>
                        <span class="nx">case</span> <span class="s1">&#39;opacity&#39;</span> <span class="o">:</span><span class="c">// IE opacity uses filter</span>
<span class="c"></span>                            <span class="nx">value</span> <span class="o">=</span> <span class="m">100</span><span class="o">;</span>
                            <span class="k">try</span> <span class="o">{</span> <span class="c">// will error if no DXImageTransform</span>
<span class="c"></span>                                <span class="nx">value</span> <span class="o">=</span> <span class="nx">el</span><span class="o">.</span><span class="nx">filters</span><span class="o">[</span><span class="s1">&#39;DXImageTransform.Microsoft.Alpha&#39;</span><span class="o">].</span><span class="nx">opacity</span><span class="o">;</span>

                            <span class="o">}</span> <span class="k">catch</span><span class="o">(</span><span class="nx">e</span><span class="o">)</span> <span class="o">{</span>
                                <span class="k">try</span> <span class="o">{</span> <span class="c">// make sure its in the document</span>
<span class="c"></span>                                    <span class="nx">value</span> <span class="o">=</span> <span class="nx">el</span><span class="o">.</span><span class="nx">filters</span><span class="o">(</span><span class="s1">&#39;alpha&#39;</span><span class="o">).</span><span class="nx">opacity</span><span class="o">;</span>
                                <span class="o">}</span> <span class="k">catch</span><span class="o">(</span><span class="nx">err</span><span class="o">)</span> <span class="o">{</span>
                                    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getStyle: IE filter failed&#39;</span><span class="o">,</span>
                                            <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                                <span class="o">}</span>
                            <span class="o">}</span>
                            <span class="k">return</span> <span class="nx">value</span> <span class="o">/</span> <span class="m">100</span><span class="o">;</span>
                        <span class="nx">case</span> <span class="s1">&#39;float&#39;</span><span class="o">:</span> <span class="c">// fix reserved word</span>
<span class="c"></span>                            <span class="nx">property</span> <span class="o">=</span> <span class="s1">&#39;styleFloat&#39;</span><span class="o">;</span> <span class="c">// fall through</span>
<span class="c"></span>                        <span class="nx">default</span><span class="o">:</span> 
                            <span class="nx">property</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_toCamel</span><span class="o">(</span><span class="nx">property</span><span class="o">);</span>
                            <span class="nx">value</span> <span class="o">=</span> <span class="nx">el</span><span class="o">[</span><span class="nx">CURRENT_STYLE</span><span class="o">]</span> <span class="o">?</span> <span class="nx">el</span><span class="o">[</span><span class="nx">CURRENT_STYLE</span><span class="o">][</span><span class="nx">property</span><span class="o">]</span> <span class="o">:</span> <span class="kc">null</span><span class="o">;</span>
                            <span class="k">return</span> <span class="o">(</span> <span class="nx">el</span><span class="o">.</span><span class="nx">style</span><span class="o">[</span><span class="nx">property</span><span class="o">]</span> <span class="o">||</span> <span class="nx">value</span> <span class="o">);</span>
                    <span class="o">}</span>
                <span class="o">};</span>
            <span class="o">}</span>
        <span class="o">}(),</span>
    
        <span class="c">/**</span>
<span class="c">         * Wrapper for setting style properties of HTMLElements.  Normalizes &quot;opacity&quot; across modern browsers.</span>
<span class="c">         * @method setStyle</span>
<span class="c">         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.</span>
<span class="c">         * @param {String} property The style property to be set.</span>
<span class="c">         * @param {String} val The value to apply to the given property.</span>
<span class="c">         */</span>
        <span class="nx">setStyle</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">property</span><span class="o">,</span> <span class="nx">val</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_setStyle</span><span class="o">,</span> <span class="o">{</span> <span class="nx">prop</span><span class="o">:</span> <span class="nx">property</span><span class="o">,</span> <span class="nx">val</span><span class="o">:</span> <span class="nx">val</span> <span class="o">});</span>
        <span class="o">},</span>

        <span class="nx">_setStyle</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
            <span class="k">if</span> <span class="o">(</span><span class="nx">isIE</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">return</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">args</span><span class="o">)</span> <span class="o">{</span>
                    <span class="k">var</span> <span class="nx">property</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_toCamel</span><span class="o">(</span><span class="nx">args</span><span class="o">.</span><span class="nx">prop</span><span class="o">),</span>
                        <span class="nx">val</span> <span class="o">=</span> <span class="nx">args</span><span class="o">.</span><span class="nx">val</span><span class="o">;</span>

                    <span class="k">if</span> <span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
                        <span class="nx">switch</span> <span class="o">(</span><span class="nx">property</span><span class="o">)</span> <span class="o">{</span>
                            <span class="nx">case</span> <span class="s1">&#39;opacity&#39;</span><span class="o">:</span>
                                <span class="k">if</span> <span class="o">(</span> <span class="nx">lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">el</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">filter</span><span class="o">)</span> <span class="o">)</span> <span class="o">{</span> <span class="c">// in case not appended</span>
<span class="c"></span>                                    <span class="nx">el</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">filter</span> <span class="o">=</span> <span class="s1">&#39;alpha(opacity=&#39;</span> <span class="o">+</span> <span class="nx">val</span> <span class="o">*</span> <span class="m">100</span> <span class="o">+</span> <span class="s1">&#39;)&#39;</span><span class="o">;</span>
                                    
                                    <span class="k">if</span> <span class="o">(!</span><span class="nx">el</span><span class="o">[</span><span class="nx">CURRENT_STYLE</span><span class="o">]</span> <span class="o">||</span> <span class="o">!</span><span class="nx">el</span><span class="o">[</span><span class="nx">CURRENT_STYLE</span><span class="o">].</span><span class="nx">hasLayout</span><span class="o">)</span> <span class="o">{</span>
                                        <span class="nx">el</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">zoom</span> <span class="o">=</span> <span class="m">1</span><span class="o">;</span> <span class="c">// when no layout or cant tell</span>
<span class="c"></span>                                    <span class="o">}</span>
                                <span class="o">}</span>
                                <span class="k">break</span><span class="o">;</span>
                            <span class="nx">case</span> <span class="s1">&#39;float&#39;</span><span class="o">:</span>
                                <span class="nx">property</span> <span class="o">=</span> <span class="s1">&#39;styleFloat&#39;</span><span class="o">;</span>
                            <span class="nx">default</span><span class="o">:</span>
                            <span class="nx">el</span><span class="o">.</span><span class="nx">style</span><span class="o">[</span><span class="nx">property</span><span class="o">]</span> <span class="o">=</span> <span class="nx">val</span><span class="o">;</span>
                        <span class="o">}</span>
                    <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;element &#39;</span> <span class="o">+</span> <span class="nx">el</span> <span class="o">+</span> <span class="s1">&#39; is undefined&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                    <span class="o">}</span>
                <span class="o">};</span>
            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                <span class="k">return</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">args</span><span class="o">)</span> <span class="o">{</span>
                    <span class="k">var</span> <span class="nx">property</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_toCamel</span><span class="o">(</span><span class="nx">args</span><span class="o">.</span><span class="nx">prop</span><span class="o">),</span>
                        <span class="nx">val</span> <span class="o">=</span> <span class="nx">args</span><span class="o">.</span><span class="nx">val</span><span class="o">;</span>
                    <span class="k">if</span> <span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
                        <span class="k">if</span> <span class="o">(</span><span class="nx">property</span> <span class="o">==</span> <span class="s1">&#39;float&#39;</span><span class="o">)</span> <span class="o">{</span>
                            <span class="nx">property</span> <span class="o">=</span> <span class="s1">&#39;cssFloat&#39;</span><span class="o">;</span>
                        <span class="o">}</span>
                        <span class="nx">el</span><span class="o">.</span><span class="nx">style</span><span class="o">[</span><span class="nx">property</span><span class="o">]</span> <span class="o">=</span> <span class="nx">val</span><span class="o">;</span>
                    <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;element &#39;</span> <span class="o">+</span> <span class="nx">el</span> <span class="o">+</span> <span class="s1">&#39; is undefined&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                    <span class="o">}</span>
                <span class="o">};</span>
            <span class="o">}</span>

        <span class="o">}(),</span>
        
        <span class="c">/**</span>
<span class="c">         * Gets the current position of an element based on page coordinates. </span>
<span class="c">         * Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).</span>
<span class="c">         * @method getXY</span>
<span class="c">         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM</span>
<span class="c">         * reference, or an Array of IDs and/or HTMLElements</span>
<span class="c">         * @return {Array} The XY position of the element(s)</span>
<span class="c">         */</span>
        <span class="nx">getXY</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_getXY</span><span class="o">);</span>
        <span class="o">},</span>

        <span class="nx">_canPosition</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="o">(</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_getStyle</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="s1">&#39;display&#39;</span><span class="o">)</span> <span class="o">!==</span> <span class="s1">&#39;none&#39;</span> <span class="o">&amp;&amp;</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_inDoc</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">);</span>
        <span class="o">},</span>

        <span class="nx">_getXY</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
            <span class="k">if</span> <span class="o">(</span><span class="nb">document</span><span class="o">[</span><span class="nx">DOCUMENT_ELEMENT</span><span class="o">][</span><span class="nx">GET_BOUNDING_CLIENT_RECT</span><span class="o">])</span> <span class="o">{</span>
                <span class="k">return</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
                    <span class="k">var</span> <span class="nx">scrollLeft</span><span class="o">,</span> <span class="nx">scrollTop</span><span class="o">,</span> <span class="nx">box</span><span class="o">,</span> <span class="nx">doc</span><span class="o">,</span>
                        <span class="nx">off1</span><span class="o">,</span> <span class="nx">off2</span><span class="o">,</span> <span class="nx">mode</span><span class="o">,</span> <span class="nx">bLeft</span><span class="o">,</span> <span class="nx">bTop</span><span class="o">,</span>
                        <span class="nx">floor</span> <span class="o">=</span> <span class="nb">Math</span><span class="o">.</span><span class="nx">floor</span><span class="o">,</span> <span class="c">// TODO: round?</span>
<span class="c"></span>                        <span class="nx">xy</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>

                    <span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_canPosition</span><span class="o">(</span><span class="nx">node</span><span class="o">))</span> <span class="o">{</span>
                        <span class="nx">box</span> <span class="o">=</span> <span class="nx">node</span><span class="o">[</span><span class="nx">GET_BOUNDING_CLIENT_RECT</span><span class="o">]();</span>
                        <span class="nx">doc</span> <span class="o">=</span> <span class="nx">node</span><span class="o">[</span><span class="nx">OWNER_DOCUMENT</span><span class="o">];</span>
                        <span class="nx">scrollLeft</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getDocumentScrollLeft</span><span class="o">(</span><span class="nx">doc</span><span class="o">);</span>
                        <span class="nx">scrollTop</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getDocumentScrollTop</span><span class="o">(</span><span class="nx">doc</span><span class="o">);</span>
                        <span class="nx">xy</span> <span class="o">=</span> <span class="o">[</span><span class="nx">floor</span><span class="o">(</span><span class="nx">box</span><span class="o">[</span><span class="nx">LEFT</span><span class="o">]),</span> <span class="nx">floor</span><span class="o">(</span><span class="nx">box</span><span class="o">[</span><span class="nx">TOP</span><span class="o">])];</span>

                        <span class="k">if</span> <span class="o">(</span><span class="nx">isIE</span> <span class="o">&amp;&amp;</span> <span class="nx">UA</span><span class="o">.</span><span class="nx">ie</span> <span class="o">&lt;</span> <span class="m">8</span><span class="o">)</span> <span class="o">{</span> <span class="c">// IE &lt; 8: viewport off by 2</span>
<span class="c"></span>                            <span class="nx">off1</span> <span class="o">=</span> <span class="m">2</span><span class="o">;</span>
                            <span class="nx">off2</span> <span class="o">=</span> <span class="m">2</span><span class="o">;</span>
                            <span class="nx">mode</span> <span class="o">=</span> <span class="nx">doc</span><span class="o">[</span><span class="nx">COMPAT_MODE</span><span class="o">];</span>
                            <span class="nx">bLeft</span> <span class="o">=</span> <span class="nx">_getComputedStyle</span><span class="o">(</span><span class="nx">doc</span><span class="o">[</span><span class="nx">DOCUMENT_ELEMENT</span><span class="o">],</span> <span class="nx">BORDER_LEFT_WIDTH</span><span class="o">);</span>
                            <span class="nx">bTop</span> <span class="o">=</span> <span class="nx">_getComputedStyle</span><span class="o">(</span><span class="nx">doc</span><span class="o">[</span><span class="nx">DOCUMENT_ELEMENT</span><span class="o">],</span> <span class="nx">BORDER_TOP_WIDTH</span><span class="o">);</span>

                            <span class="k">if</span> <span class="o">(</span><span class="nx">UA</span><span class="o">.</span><span class="nx">ie</span> <span class="o">===</span> <span class="m">6</span><span class="o">)</span> <span class="o">{</span>
                                <span class="k">if</span> <span class="o">(</span><span class="nx">mode</span> <span class="o">!==</span> <span class="nx">_BACK_COMPAT</span><span class="o">)</span> <span class="o">{</span>
                                    <span class="nx">off1</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>
                                    <span class="nx">off2</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>
                                <span class="o">}</span>
                            <span class="o">}</span>
                            
                            <span class="k">if</span> <span class="o">((</span><span class="nx">mode</span> <span class="o">==</span> <span class="nx">_BACK_COMPAT</span><span class="o">))</span> <span class="o">{</span>
                                <span class="k">if</span> <span class="o">(</span><span class="nx">bLeft</span> <span class="o">!==</span> <span class="nx">MEDIUM</span><span class="o">)</span> <span class="o">{</span>
                                    <span class="nx">off1</span> <span class="o">=</span> <span class="nb">parseInt</span><span class="o">(</span><span class="nx">bLeft</span><span class="o">,</span> <span class="m">10</span><span class="o">);</span>
                                <span class="o">}</span>
                                <span class="k">if</span> <span class="o">(</span><span class="nx">bTop</span> <span class="o">!==</span> <span class="nx">MEDIUM</span><span class="o">)</span> <span class="o">{</span>
                                    <span class="nx">off2</span> <span class="o">=</span> <span class="nb">parseInt</span><span class="o">(</span><span class="nx">bTop</span><span class="o">,</span> <span class="m">10</span><span class="o">);</span>
                                <span class="o">}</span>
                            <span class="o">}</span>
                            
                            <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">-=</span> <span class="nx">off1</span><span class="o">;</span>
                            <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">-=</span> <span class="nx">off2</span><span class="o">;</span>

                        <span class="o">}</span>

                        <span class="k">if</span> <span class="o">((</span><span class="nx">scrollTop</span> <span class="o">||</span> <span class="nx">scrollLeft</span><span class="o">))</span> <span class="o">{</span>
                            <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">+=</span> <span class="nx">scrollLeft</span><span class="o">;</span>
                            <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">+=</span> <span class="nx">scrollTop</span><span class="o">;</span>
                        <span class="o">}</span>

                        <span class="c">// gecko may return sub-pixel (non-int) values</span>
<span class="c"></span>                        <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">=</span> <span class="nx">floor</span><span class="o">(</span><span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]);</span>
                        <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">=</span> <span class="nx">floor</span><span class="o">(</span><span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]);</span>
                    <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getXY failed: element not positionable (either not in a document or not displayed)&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                    <span class="o">}</span>

                    <span class="k">return</span> <span class="nx">xy</span><span class="o">;</span>
                <span class="o">};</span>
            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                <span class="k">return</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span> <span class="c">// ff2, safari: manually calculate by crawling up offsetParents</span>
<span class="c"></span>                    <span class="k">var</span> <span class="nx">docScrollLeft</span><span class="o">,</span> <span class="nx">docScrollTop</span><span class="o">,</span>
                        <span class="nx">scrollTop</span><span class="o">,</span> <span class="nx">scrollLeft</span><span class="o">,</span>
                        <span class="nx">bCheck</span><span class="o">,</span>
                        <span class="nx">xy</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
                        <span class="nx">parentNode</span> <span class="o">=</span> <span class="nx">node</span><span class="o">;</span>

                    <span class="k">if</span>  <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_canPosition</span><span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
                        <span class="nx">xy</span> <span class="o">=</span> <span class="o">[</span><span class="nx">node</span><span class="o">[</span><span class="nx">OFFSET_LEFT</span><span class="o">],</span> <span class="nx">node</span><span class="o">[</span><span class="nx">OFFSET_TOP</span><span class="o">]];</span>
                        <span class="nx">docScrollLeft</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getDocumentScrollLeft</span><span class="o">(</span><span class="nx">node</span><span class="o">[</span><span class="nx">OWNER_DOCUMENT</span><span class="o">]);</span>
                        <span class="nx">docScrollTop</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getDocumentScrollTop</span><span class="o">(</span><span class="nx">node</span><span class="o">[</span><span class="nx">OWNER_DOCUMENT</span><span class="o">]);</span>

                        <span class="c">// TODO: refactor with !! or just falsey</span>
<span class="c"></span>                        <span class="nx">bCheck</span> <span class="o">=</span> <span class="o">((</span><span class="nx">isGecko</span> <span class="o">||</span> <span class="nx">UA</span><span class="o">.</span><span class="nx">webkit</span> <span class="o">&gt;</span> <span class="m">519</span><span class="o">)</span> <span class="o">?</span> <span class="kc">true</span> <span class="o">:</span> <span class="kc">false</span><span class="o">);</span>

                        <span class="c">// TODO: worth refactoring for TOP/LEFT only?</span>
<span class="c"></span>                        <span class="k">while</span> <span class="o">((</span><span class="nx">parentNode</span> <span class="o">=</span> <span class="nx">parentNode</span><span class="o">[</span><span class="nx">OFFSET_PARENT</span><span class="o">]))</span> <span class="o">{</span>
                            <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">+=</span> <span class="nx">parentNode</span><span class="o">[</span><span class="nx">OFFSET_LEFT</span><span class="o">];</span>
                            <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">+=</span> <span class="nx">parentNode</span><span class="o">[</span><span class="nx">OFFSET_TOP</span><span class="o">];</span>
                            <span class="k">if</span> <span class="o">(</span><span class="nx">bCheck</span><span class="o">)</span> <span class="o">{</span>
                                <span class="nx">xy</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_calcBorders</span><span class="o">(</span><span class="nx">parentNode</span><span class="o">,</span> <span class="nx">xy</span><span class="o">);</span>
                            <span class="o">}</span>
                        <span class="o">}</span>

                        <span class="c">// account for any scrolled ancestors</span>
<span class="c"></span>                        <span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_getStyle</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">POSITION</span><span class="o">)</span> <span class="o">!==</span> <span class="nx">FIXED</span><span class="o">)</span> <span class="o">{</span>
                            <span class="nx">parentNode</span> <span class="o">=</span> <span class="nx">node</span><span class="o">;</span>

                            <span class="k">while</span> <span class="o">((</span><span class="nx">parentNode</span> <span class="o">=</span> <span class="nx">parentNode</span><span class="o">[</span><span class="nx">PARENT_NODE</span><span class="o">])</span> <span class="o">&amp;&amp;</span> <span class="nx">parentNode</span><span class="o">[</span><span class="nx">TAG_NAME</span><span class="o">])</span> <span class="o">{</span>
                                <span class="nx">scrollTop</span> <span class="o">=</span> <span class="nx">parentNode</span><span class="o">[</span><span class="nx">SCROLL_TOP</span><span class="o">];</span>
                                <span class="nx">scrollLeft</span> <span class="o">=</span> <span class="nx">parentNode</span><span class="o">[</span><span class="nx">SCROLL_LEFT</span><span class="o">];</span>

                                <span class="c">//Firefox does something funky with borders when overflow is not visible.</span>
<span class="c"></span>                                <span class="k">if</span> <span class="o">(</span><span class="nx">isGecko</span> <span class="o">&amp;&amp;</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_getStyle</span><span class="o">(</span><span class="nx">parentNode</span><span class="o">,</span> <span class="s1">&#39;overflow&#39;</span><span class="o">)</span> <span class="o">!==</span> <span class="s1">&#39;visible&#39;</span><span class="o">))</span> <span class="o">{</span>
                                        <span class="nx">xy</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_calcBorders</span><span class="o">(</span><span class="nx">parentNode</span><span class="o">,</span> <span class="nx">xy</span><span class="o">);</span>
                                <span class="o">}</span>

                                <span class="k">if</span> <span class="o">(</span><span class="nx">scrollTop</span> <span class="o">||</span> <span class="nx">scrollLeft</span><span class="o">)</span> <span class="o">{</span>
                                    <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">-=</span> <span class="nx">scrollLeft</span><span class="o">;</span>
                                    <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">-=</span> <span class="nx">scrollTop</span><span class="o">;</span>
                                <span class="o">}</span>
                            <span class="o">}</span>
                            <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">+=</span> <span class="nx">docScrollLeft</span><span class="o">;</span>
                            <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">+=</span> <span class="nx">docScrollTop</span><span class="o">;</span>

                        <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                            <span class="c">//Fix FIXED position -- add scrollbars</span>
<span class="c"></span>                            <span class="k">if</span> <span class="o">(</span><span class="nx">isOpera</span><span class="o">)</span> <span class="o">{</span>
                                <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">-=</span> <span class="nx">docScrollLeft</span><span class="o">;</span>
                                <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">-=</span> <span class="nx">docScrollTop</span><span class="o">;</span>
                            <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">isSafari</span> <span class="o">||</span> <span class="nx">isGecko</span><span class="o">)</span> <span class="o">{</span>
                                <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">+=</span> <span class="nx">docScrollLeft</span><span class="o">;</span>
                                <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">+=</span> <span class="nx">docScrollTop</span><span class="o">;</span>
                            <span class="o">}</span>
                        <span class="o">}</span>
                        <span class="c">//Round the numbers so we get sane data back</span>
<span class="c"></span>                        <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">=</span> <span class="nb">Math</span><span class="o">.</span><span class="nx">floor</span><span class="o">(</span><span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]);</span>
                        <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">=</span> <span class="nb">Math</span><span class="o">.</span><span class="nx">floor</span><span class="o">(</span><span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]);</span>
                    <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getXY failed: element not positionable (either not in a document or not displayed)&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                    <span class="o">}</span>
                    <span class="k">return</span> <span class="nx">xy</span><span class="o">;</span>                
                <span class="o">};</span>
            <span class="o">}</span>
        <span class="o">}(),</span> <span class="c">// NOTE: Executing for loadtime branching</span>
<span class="c"></span>        
        <span class="c">/**</span>
<span class="c">         * Gets the current X position of an element based on page coordinates.  The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).</span>
<span class="c">         * @method getX</span>
<span class="c">         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements</span>
<span class="c">         * @return {Number | Array} The X position of the element(s)</span>
<span class="c">         */</span>
        <span class="nx">getX</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">f</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getXY</span><span class="o">(</span><span class="nx">el</span><span class="o">)[</span><span class="m">0</span><span class="o">];</span>
            <span class="o">};</span>
            
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">f</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Gets the current Y position of an element based on page coordinates.  Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).</span>
<span class="c">         * @method getY</span>
<span class="c">         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements</span>
<span class="c">         * @return {Number | Array} The Y position of the element(s)</span>
<span class="c">         */</span>
        <span class="nx">getY</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">f</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getXY</span><span class="o">(</span><span class="nx">el</span><span class="o">)[</span><span class="m">1</span><span class="o">];</span>
            <span class="o">};</span>
            
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">f</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Set the position of an html element in page coordinates, regardless of how the element is positioned.</span>
<span class="c">         * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).</span>
<span class="c">         * @method setXY</span>
<span class="c">         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements</span>
<span class="c">         * @param {Array} pos Contains X &amp; Y values for new position (coordinates are page-based)</span>
<span class="c">         * @param {Boolean} noRetry By default we try and set the position a second time if the first fails</span>
<span class="c">         */</span>
        <span class="nx">setXY</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">pos</span><span class="o">,</span> <span class="nx">noRetry</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_setXY</span><span class="o">,</span> <span class="o">{</span> <span class="nx">pos</span><span class="o">:</span> <span class="nx">pos</span><span class="o">,</span> <span class="nx">noRetry</span><span class="o">:</span> <span class="nx">noRetry</span> <span class="o">});</span>
        <span class="o">},</span>

        <span class="nx">_setXY</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">args</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">pos</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_getStyle</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">POSITION</span><span class="o">),</span>
                <span class="nx">setStyle</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setStyle</span><span class="o">,</span>
                <span class="nx">xy</span> <span class="o">=</span> <span class="nx">args</span><span class="o">.</span><span class="nx">pos</span><span class="o">,</span>
                <span class="nx">noRetry</span> <span class="o">=</span> <span class="nx">args</span><span class="o">.</span><span class="nx">noRetry</span><span class="o">,</span>

                <span class="nx">delta</span> <span class="o">=</span> <span class="o">[</span> <span class="c">// assuming pixels; if not we will have to retry</span>
<span class="c"></span>                    <span class="nb">parseInt</span><span class="o">(</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getComputedStyle</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">LEFT</span><span class="o">),</span> <span class="m">10</span> <span class="o">),</span>
                    <span class="nb">parseInt</span><span class="o">(</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getComputedStyle</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">TOP</span><span class="o">),</span> <span class="m">10</span> <span class="o">)</span>
                <span class="o">],</span>

                <span class="nx">currentXY</span><span class="o">,</span>
                <span class="nx">newXY</span><span class="o">;</span>
        
            <span class="k">if</span> <span class="o">(</span><span class="nx">pos</span> <span class="o">==</span> <span class="s1">&#39;static&#39;</span><span class="o">)</span> <span class="o">{</span> <span class="c">// default to relative</span>
<span class="c"></span>                <span class="nx">pos</span> <span class="o">=</span> <span class="nx">RELATIVE</span><span class="o">;</span>
                <span class="nx">setStyle</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">POSITION</span><span class="o">,</span> <span class="nx">pos</span><span class="o">);</span>
            <span class="o">}</span>

            <span class="nx">currentXY</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_getXY</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>

            <span class="k">if</span> <span class="o">(!</span><span class="nx">xy</span> <span class="o">||</span> <span class="nx">currentXY</span> <span class="o">===</span> <span class="kc">false</span><span class="o">)</span> <span class="o">{</span> <span class="c">// has to be part of doc to have xy</span>
<span class="c"></span>                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;xy failed: node not available&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Node&#39;</span><span class="o">);</span>
                <span class="k">return</span> <span class="kc">false</span><span class="o">;</span> 
            <span class="o">}</span>
            
            <span class="k">if</span> <span class="o">(</span> <span class="nb">isNaN</span><span class="o">(</span><span class="nx">delta</span><span class="o">[</span><span class="m">0</span><span class="o">])</span> <span class="o">)</span> <span class="o">{</span><span class="c">// in case of &#39;auto&#39;</span>
<span class="c"></span>                <span class="nx">delta</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">=</span> <span class="o">(</span><span class="nx">pos</span> <span class="o">==</span> <span class="nx">RELATIVE</span><span class="o">)</span> <span class="o">?</span> <span class="m">0</span> <span class="o">:</span> <span class="nx">node</span><span class="o">[</span><span class="nx">OFFSET_LEFT</span><span class="o">];</span>
            <span class="o">}</span> 
            <span class="k">if</span> <span class="o">(</span> <span class="nb">isNaN</span><span class="o">(</span><span class="nx">delta</span><span class="o">[</span><span class="m">1</span><span class="o">])</span> <span class="o">)</span> <span class="o">{</span> <span class="c">// in case of &#39;auto&#39;</span>
<span class="c"></span>                <span class="nx">delta</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">=</span> <span class="o">(</span><span class="nx">pos</span> <span class="o">==</span> <span class="nx">RELATIVE</span><span class="o">)</span> <span class="o">?</span> <span class="m">0</span> <span class="o">:</span> <span class="nx">node</span><span class="o">[</span><span class="nx">OFFSET_TOP</span><span class="o">];</span>
            <span class="o">}</span> 

            <span class="k">if</span> <span class="o">(</span><span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">!==</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span> <span class="c">// from setX</span>
<span class="c"></span>                <span class="nx">setStyle</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">LEFT</span><span class="o">,</span> <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">-</span> <span class="nx">currentXY</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">+</span> <span class="nx">delta</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">+</span> <span class="s1">&#39;px&#39;</span><span class="o">);</span>
            <span class="o">}</span>

            <span class="k">if</span> <span class="o">(</span><span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">!==</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span> <span class="c">// from setY</span>
<span class="c"></span>                <span class="nx">setStyle</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">TOP</span><span class="o">,</span> <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">-</span> <span class="nx">currentXY</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">+</span> <span class="nx">delta</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">+</span> <span class="s1">&#39;px&#39;</span><span class="o">);</span>
            <span class="o">}</span>
          
            <span class="k">if</span> <span class="o">(!</span><span class="nx">noRetry</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">newXY</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_getXY</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>

                <span class="c">// if retry is true, try one more time if we miss </span>
<span class="c"></span>               <span class="k">if</span> <span class="o">(</span> <span class="o">(</span><span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">!==</span> <span class="kc">null</span> <span class="o">&amp;&amp;</span> <span class="nx">newXY</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">!=</span> <span class="nx">xy</span><span class="o">[</span><span class="m">0</span><span class="o">])</span> <span class="o">||</span> 
                    <span class="o">(</span><span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">!==</span> <span class="kc">null</span> <span class="o">&amp;&amp;</span> <span class="nx">newXY</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">!=</span> <span class="nx">xy</span><span class="o">[</span><span class="m">1</span><span class="o">])</span> <span class="o">)</span> <span class="o">{</span>
                   <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_setXY</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="o">{</span> <span class="nx">pos</span><span class="o">:</span> <span class="nx">xy</span><span class="o">,</span> <span class="nx">noRetry</span><span class="o">:</span> <span class="kc">true</span> <span class="o">});</span>
               <span class="o">}</span>
            <span class="o">}</span>        

            <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;setXY setting position to &#39;</span> <span class="o">+</span> <span class="nx">xy</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;Node&#39;</span><span class="o">);</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Set the X position of an html element in page coordinates, regardless of how the element is positioned.</span>
<span class="c">         * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).</span>
<span class="c">         * @method setX</span>
<span class="c">         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.</span>
<span class="c">         * @param {Int} x The value to use as the X coordinate for the element(s).</span>
<span class="c">         */</span>
        <span class="nx">setX</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">x</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setXY</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="o">[</span><span class="nx">x</span><span class="o">,</span> <span class="kc">null</span><span class="o">]);</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Set the Y position of an html element in page coordinates, regardless of how the element is positioned.</span>
<span class="c">         * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).</span>
<span class="c">         * @method setY</span>
<span class="c">         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.</span>
<span class="c">         * @param {Int} x To use as the Y coordinate for the element(s).</span>
<span class="c">         */</span>
        <span class="nx">setY</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">y</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setXY</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="o">[</span><span class="kc">null</span><span class="o">,</span> <span class="nx">y</span><span class="o">]);</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Returns the region position of the given element.</span>
<span class="c">         * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).</span>
<span class="c">         * @method getRegion</span>
<span class="c">         * @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.</span>
<span class="c">         * @return {Region | Array} A Region or array of Region instances containing &quot;top, left, bottom, right&quot; member data.</span>
<span class="c">         */</span>
        <span class="nx">getRegion</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">f</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">var</span> <span class="nx">region</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
                <span class="k">if</span> <span class="o">(</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_canPosition</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
                    <span class="nx">region</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Region</span><span class="o">.</span><span class="nx">getRegion</span><span class="o">(</span><span class="nx">el</span><span class="o">);</span>
                    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getRegion returning &#39;</span> <span class="o">+</span> <span class="nx">region</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getRegion failed: element not positionable (either not in a document or not displayed)&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                <span class="o">}</span>

                <span class="k">return</span> <span class="nx">region</span><span class="o">;</span>
            <span class="o">};</span>
            
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">f</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Returns the width of the client (viewport).</span>
<span class="c">         * @method getClientWidth</span>
<span class="c">         * @deprecated Now using getViewportWidth.  This interface left intact for back compat.</span>
<span class="c">         * @return {Int} The width of the viewable area of the page.</span>
<span class="c">         */</span>
        <span class="nx">getClientWidth</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getViewportWidth</span><span class="o">();</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Returns the height of the client (viewport).</span>
<span class="c">         * @method getClientHeight</span>
<span class="c">         * @deprecated Now using getViewportHeight.  This interface left intact for back compat.</span>
<span class="c">         * @return {Int} The height of the viewable area of the page.</span>
<span class="c">         */</span>
        <span class="nx">getClientHeight</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getViewportHeight</span><span class="o">();</span>
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Returns a array of HTMLElements with the given class.</span>
<span class="c">         * For optimized performance, include a tag and/or root node when possible.</span>
<span class="c">         * Note: This method operates against a live collection, so modifying the </span>
<span class="c">         * collection in the callback (removing/appending nodes, etc.) will have</span>
<span class="c">         * side effects.  Instead you should iterate the returned nodes array,</span>
<span class="c">         * as you would with the native &quot;getElementsByTagName&quot; method. </span>
<span class="c">         * @method getElementsByClassName</span>
<span class="c">         * @param {String} className The class name to match against</span>
<span class="c">         * @param {String} tag (optional) The tag name of the elements being collected</span>
<span class="c">         * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point </span>
<span class="c">         * @param {Function} apply (optional) A function to apply to each element when found </span>
<span class="c">         * @param {Any} o (optional) An optional arg that is passed to the supplied method</span>
<span class="c">         * @param {Boolean} overrides (optional) Whether or not to override the scope of &quot;method&quot; with &quot;o&quot;</span>
<span class="c">         * @return {Array} An array of elements that have the given class name</span>
<span class="c">         */</span>
        <span class="nx">getElementsByClassName</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">className</span><span class="o">,</span> <span class="nx">tag</span><span class="o">,</span> <span class="nx">root</span><span class="o">,</span> <span class="nx">apply</span><span class="o">,</span> <span class="nx">o</span><span class="o">,</span> <span class="nx">overrides</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">className</span> <span class="o">=</span> <span class="nx">lang</span><span class="o">.</span><span class="nx">trim</span><span class="o">(</span><span class="nx">className</span><span class="o">);</span>
            <span class="nx">tag</span> <span class="o">=</span> <span class="nx">tag</span> <span class="o">||</span> <span class="s1">&#39;*&#39;</span><span class="o">;</span>
            <span class="nx">root</span> <span class="o">=</span> <span class="o">(</span><span class="nx">root</span><span class="o">)</span> <span class="o">?</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">root</span><span class="o">)</span> <span class="o">:</span> <span class="kc">null</span> <span class="o">||</span> <span class="nb">document</span><span class="o">;</span> 
            <span class="k">if</span> <span class="o">(!</span><span class="nx">root</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">return</span> <span class="o">[];</span>
            <span class="o">}</span>

            <span class="k">var</span> <span class="nx">nodes</span> <span class="o">=</span> <span class="o">[],</span>
                <span class="nx">elements</span> <span class="o">=</span> <span class="nx">root</span><span class="o">.</span><span class="nx">getElementsByTagName</span><span class="o">(</span><span class="nx">tag</span><span class="o">),</span>
                <span class="nx">hasClass</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">hasClass</span><span class="o">;</span>

            <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="m">0</span><span class="o">,</span> <span class="nx">len</span> <span class="o">=</span> <span class="nx">elements</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">len</span><span class="o">;</span> <span class="o">++</span><span class="nx">i</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span> <span class="nx">hasClass</span><span class="o">(</span><span class="nx">elements</span><span class="o">[</span><span class="nx">i</span><span class="o">],</span> <span class="nx">className</span><span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
                    <span class="nx">nodes</span><span class="o">[</span><span class="nx">nodes</span><span class="o">.</span><span class="nx">length</span><span class="o">]</span> <span class="o">=</span> <span class="nx">elements</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
                <span class="o">}</span>
            <span class="o">}</span>
            
            <span class="k">if</span> <span class="o">(</span><span class="nx">apply</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">nodes</span><span class="o">,</span> <span class="nx">apply</span><span class="o">,</span> <span class="nx">o</span><span class="o">,</span> <span class="nx">overrides</span><span class="o">);</span>
            <span class="o">}</span>

            <span class="k">return</span> <span class="nx">nodes</span><span class="o">;</span>
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Determines whether an HTMLElement has the given className.</span>
<span class="c">         * @method hasClass</span>
<span class="c">         * @param {String | HTMLElement | Array} el The element or collection to test</span>
<span class="c">         * @param {String} className the class name to search for</span>
<span class="c">         * @return {Boolean | Array} A boolean value or array of boolean values</span>
<span class="c">         */</span>
        <span class="nx">hasClass</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_hasClass</span><span class="o">,</span> <span class="nx">className</span><span class="o">);</span>
        <span class="o">},</span>

        <span class="nx">_hasClass</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">ret</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
                <span class="nx">current</span><span class="o">;</span>
            
            <span class="k">if</span> <span class="o">(</span><span class="nx">el</span> <span class="o">&amp;&amp;</span> <span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">current</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getAttribute</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">CLASS_NAME</span><span class="o">)</span> <span class="o">||</span> <span class="nx">EMPTY</span><span class="o">;</span>
                <span class="k">if</span> <span class="o">(</span><span class="nx">className</span><span class="o">.</span><span class="nx">exec</span><span class="o">)</span> <span class="o">{</span>
                    <span class="nx">ret</span> <span class="o">=</span> <span class="nx">className</span><span class="o">.</span><span class="nx">test</span><span class="o">(</span><span class="nx">current</span><span class="o">);</span>
                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                    <span class="nx">ret</span> <span class="o">=</span> <span class="nx">className</span> <span class="o">&amp;&amp;</span> <span class="o">(</span><span class="nx">SPACE</span> <span class="o">+</span> <span class="nx">current</span> <span class="o">+</span> <span class="nx">SPACE</span><span class="o">).</span>
                        <span class="nx">indexOf</span><span class="o">(</span><span class="nx">SPACE</span> <span class="o">+</span> <span class="nx">className</span> <span class="o">+</span> <span class="nx">SPACE</span><span class="o">)</span> <span class="o">&gt;</span> <span class="o">-</span><span class="m">1</span><span class="o">;</span>
                <span class="o">}</span>
            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;hasClass called with invalid arguments&#39;</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="o">}</span>

            <span class="k">return</span> <span class="nx">ret</span><span class="o">;</span>
        <span class="o">},</span>
    
        <span class="c">/**</span>
<span class="c">         * Adds a class name to a given element or collection of elements.</span>
<span class="c">         * @method addClass         </span>
<span class="c">         * @param {String | HTMLElement | Array} el The element or collection to add the class to</span>
<span class="c">         * @param {String} className the class name to add to the class attribute</span>
<span class="c">         * @return {Boolean | Array} A pass/fail boolean or array of booleans</span>
<span class="c">         */</span>
        <span class="nx">addClass</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_addClass</span><span class="o">,</span> <span class="nx">className</span><span class="o">);</span>
        <span class="o">},</span>

        <span class="nx">_addClass</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">ret</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
                <span class="nx">current</span><span class="o">;</span>

            <span class="k">if</span> <span class="o">(</span><span class="nx">el</span> <span class="o">&amp;&amp;</span> <span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">current</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getAttribute</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">CLASS_NAME</span><span class="o">)</span> <span class="o">||</span> <span class="nx">EMPTY</span><span class="o">;</span>
                <span class="k">if</span> <span class="o">(</span> <span class="o">!</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_hasClass</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">className</span><span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
                    <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">CLASS_NAME</span><span class="o">,</span> <span class="nx">trim</span><span class="o">(</span><span class="nx">current</span> <span class="o">+</span> <span class="nx">SPACE</span> <span class="o">+</span> <span class="nx">className</span><span class="o">));</span>
                    <span class="nx">ret</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
                <span class="o">}</span>
            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;addClass called with invalid arguments&#39;</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="o">}</span>

            <span class="k">return</span> <span class="nx">ret</span><span class="o">;</span>
        <span class="o">},</span>
    
        <span class="c">/**</span>
<span class="c">         * Removes a class name from a given element or collection of elements.</span>
<span class="c">         * @method removeClass         </span>
<span class="c">         * @param {String | HTMLElement | Array} el The element or collection to remove the class from</span>
<span class="c">         * @param {String} className the class name to remove from the class attribute</span>
<span class="c">         * @return {Boolean | Array} A pass/fail boolean or array of booleans</span>
<span class="c">         */</span>
        <span class="nx">removeClass</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_removeClass</span><span class="o">,</span> <span class="nx">className</span><span class="o">);</span>
        <span class="o">},</span>
        
        <span class="nx">_removeClass</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">ret</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
                <span class="nx">current</span><span class="o">,</span>
                <span class="nx">newClass</span><span class="o">,</span>
                <span class="nx">attr</span><span class="o">;</span>

            <span class="k">if</span> <span class="o">(</span><span class="nx">el</span> <span class="o">&amp;&amp;</span> <span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">current</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getAttribute</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">CLASS_NAME</span><span class="o">)</span> <span class="o">||</span> <span class="nx">EMPTY</span><span class="o">;</span>
                <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">CLASS_NAME</span><span class="o">,</span> <span class="nx">current</span><span class="o">.</span><span class="nx">replace</span><span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_getClassRegex</span><span class="o">(</span><span class="nx">className</span><span class="o">),</span> <span class="nx">EMPTY</span><span class="o">));</span>

                <span class="nx">newClass</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getAttribute</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">CLASS_NAME</span><span class="o">);</span>
                <span class="k">if</span> <span class="o">(</span><span class="nx">current</span> <span class="o">!==</span> <span class="nx">newClass</span><span class="o">)</span> <span class="o">{</span> <span class="c">// else nothing changed</span>
<span class="c"></span>                    <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">CLASS_NAME</span><span class="o">,</span> <span class="nx">trim</span><span class="o">(</span><span class="nx">newClass</span><span class="o">));</span> <span class="c">// trim after comparing to current class</span>
<span class="c"></span>                    <span class="nx">ret</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>

                    <span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getAttribute</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">CLASS_NAME</span><span class="o">)</span> <span class="o">===</span> <span class="s1">&#39;&#39;</span><span class="o">)</span> <span class="o">{</span> <span class="c">// remove class attribute if empty</span>
<span class="c"></span>                        <span class="nx">attr</span> <span class="o">=</span> <span class="o">(</span><span class="nx">el</span><span class="o">.</span><span class="nx">hasAttribute</span> <span class="o">&amp;&amp;</span> <span class="nx">el</span><span class="o">.</span><span class="nx">hasAttribute</span><span class="o">(</span><span class="nx">_CLASS</span><span class="o">))</span> <span class="o">?</span> <span class="nx">_CLASS</span> <span class="o">:</span> <span class="nx">CLASS_NAME</span><span class="o">;</span>
                        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;removeClass removing empty class attribute&#39;</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                        <span class="nx">el</span><span class="o">.</span><span class="nx">removeAttribute</span><span class="o">(</span><span class="nx">attr</span><span class="o">);</span>
                    <span class="o">}</span>
                <span class="o">}</span>

            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;removeClass called with invalid arguments&#39;</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="o">}</span>

            <span class="k">return</span> <span class="nx">ret</span><span class="o">;</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Replace a class with another class for a given element or collection of elements.</span>
<span class="c">         * If no oldClassName is present, the newClassName is simply added.</span>
<span class="c">         * @method replaceClass  </span>
<span class="c">         * @param {String | HTMLElement | Array} el The element or collection to remove the class from</span>
<span class="c">         * @param {String} oldClassName the class name to be replaced</span>
<span class="c">         * @param {String} newClassName the class name that will be replacing the old class name</span>
<span class="c">         * @return {Boolean | Array} A pass/fail boolean or array of booleans</span>
<span class="c">         */</span>
        <span class="nx">replaceClass</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">oldClassName</span><span class="o">,</span> <span class="nx">newClassName</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_replaceClass</span><span class="o">,</span> <span class="o">{</span> <span class="nx">from</span><span class="o">:</span> <span class="nx">oldClassName</span><span class="o">,</span> <span class="nx">to</span><span class="o">:</span> <span class="nx">newClassName</span> <span class="o">});</span>
        <span class="o">},</span>

        <span class="nx">_replaceClass</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">classObj</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">className</span><span class="o">,</span>
                <span class="nx">from</span><span class="o">,</span>
                <span class="nx">to</span><span class="o">,</span>
                <span class="nx">ret</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
                <span class="nx">current</span><span class="o">;</span>

            <span class="k">if</span> <span class="o">(</span><span class="nx">el</span> <span class="o">&amp;&amp;</span> <span class="nx">classObj</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">from</span> <span class="o">=</span> <span class="nx">classObj</span><span class="o">.</span><span class="nx">from</span><span class="o">;</span>
                <span class="nx">to</span> <span class="o">=</span> <span class="nx">classObj</span><span class="o">.</span><span class="nx">to</span><span class="o">;</span>

                <span class="k">if</span> <span class="o">(!</span><span class="nx">to</span><span class="o">)</span> <span class="o">{</span>
                    <span class="nx">ret</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
                <span class="o">}</span>  <span class="k">else</span> <span class="k">if</span> <span class="o">(!</span><span class="nx">from</span><span class="o">)</span> <span class="o">{</span> <span class="c">// just add if no &quot;from&quot;</span>
<span class="c"></span>                    <span class="nx">ret</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_addClass</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">classObj</span><span class="o">.</span><span class="nx">to</span><span class="o">);</span>
                <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">from</span> <span class="o">!==</span> <span class="nx">to</span><span class="o">)</span> <span class="o">{</span> <span class="c">// else nothing to replace</span>
<span class="c"></span>                    <span class="c">// May need to lead with DBLSPACE?</span>
<span class="c"></span>                    <span class="nx">current</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getAttribute</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">CLASS_NAME</span><span class="o">)</span> <span class="o">||</span> <span class="nx">EMPTY</span><span class="o">;</span>
                    <span class="nx">className</span> <span class="o">=</span> <span class="o">(</span><span class="nx">SPACE</span> <span class="o">+</span> <span class="nx">current</span><span class="o">.</span><span class="nx">replace</span><span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_getClassRegex</span><span class="o">(</span><span class="nx">from</span><span class="o">),</span> <span class="nx">SPACE</span> <span class="o">+</span> <span class="nx">to</span><span class="o">)).</span>
                               <span class="nx">split</span><span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_getClassRegex</span><span class="o">(</span><span class="nx">to</span><span class="o">));</span>

                    <span class="c">// insert to into what would have been the first occurrence slot</span>
<span class="c"></span>                    <span class="nx">className</span><span class="o">.</span><span class="nx">splice</span><span class="o">(</span><span class="m">1</span><span class="o">,</span> <span class="m">0</span><span class="o">,</span> <span class="nx">SPACE</span> <span class="o">+</span> <span class="nx">to</span><span class="o">);</span>
                    <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">CLASS_NAME</span><span class="o">,</span> <span class="nx">trim</span><span class="o">(</span><span class="nx">className</span><span class="o">.</span><span class="nx">join</span><span class="o">(</span><span class="nx">EMPTY</span><span class="o">)));</span>
                    <span class="nx">ret</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
                <span class="o">}</span>
            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;replaceClass called with invalid arguments&#39;</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="o">}</span>

            <span class="k">return</span> <span class="nx">ret</span><span class="o">;</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Returns an ID and applies it to the element &quot;el&quot;, if provided.</span>
<span class="c">         * @method generateId  </span>
<span class="c">         * @param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present).</span>
<span class="c">         * @param {String} prefix (optional) an optional prefix to use (defaults to &quot;yui-gen&quot;).</span>
<span class="c">         * @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element)</span>
<span class="c">         */</span>
        <span class="nx">generateId</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">prefix</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">prefix</span> <span class="o">=</span> <span class="nx">prefix</span> <span class="o">||</span> <span class="s1">&#39;yui-gen&#39;</span><span class="o">;</span>

            <span class="k">var</span> <span class="nx">f</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span><span class="nx">el</span> <span class="o">&amp;&amp;</span> <span class="nx">el</span><span class="o">.</span><span class="nx">id</span><span class="o">)</span> <span class="o">{</span> <span class="c">// do not override existing ID</span>
<span class="c"></span>                    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;generateId returning existing id &#39;</span> <span class="o">+</span> <span class="nx">el</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                    <span class="k">return</span> <span class="nx">el</span><span class="o">.</span><span class="nx">id</span><span class="o">;</span>
                <span class="o">}</span>

                <span class="k">var</span> <span class="nx">id</span> <span class="o">=</span> <span class="nx">prefix</span> <span class="o">+</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">env</span><span class="o">.</span><span class="nx">_id_counter</span><span class="o">++;</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;generateId generating &#39;</span> <span class="o">+</span> <span class="nx">id</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>

                <span class="k">if</span> <span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
                    <span class="k">if</span> <span class="o">(</span><span class="nx">el</span><span class="o">[</span><span class="nx">OWNER_DOCUMENT</span><span class="o">].</span><span class="nx">getElementById</span><span class="o">(</span><span class="nx">id</span><span class="o">))</span> <span class="o">{</span> <span class="c">// in case one already exists</span>
<span class="c"></span>                        <span class="c">// use failed id plus prefix to help ensure uniqueness</span>
<span class="c"></span>                        <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">generateId</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">id</span> <span class="o">+</span> <span class="nx">prefix</span><span class="o">);</span>
                    <span class="o">}</span>
                    <span class="nx">el</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="nx">id</span><span class="o">;</span>
                <span class="o">}</span>
                
                <span class="k">return</span> <span class="nx">id</span><span class="o">;</span>
            <span class="o">};</span>

            <span class="c">// batch fails when no element, so just generate and return single ID</span>
<span class="c"></span>            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">f</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">,</span> <span class="kc">true</span><span class="o">)</span> <span class="o">||</span> <span class="nx">f</span><span class="o">.</span><span class="nx">apply</span><span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">);</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.</span>
<span class="c">         * @method isAncestor</span>
<span class="c">         * @param {String | HTMLElement} haystack The possible ancestor</span>
<span class="c">         * @param {String | HTMLElement} needle The possible descendent</span>
<span class="c">         * @return {Boolean} Whether or not the haystack is an ancestor of needle</span>
<span class="c">         */</span>
        <span class="nx">isAncestor</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">haystack</span><span class="o">,</span> <span class="nx">needle</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">haystack</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">haystack</span><span class="o">);</span>
            <span class="nx">needle</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">needle</span><span class="o">);</span>
            
            <span class="k">var</span> <span class="nx">ret</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>

            <span class="k">if</span> <span class="o">(</span> <span class="o">(</span><span class="nx">haystack</span> <span class="o">&amp;&amp;</span> <span class="nx">needle</span><span class="o">)</span> <span class="o">&amp;&amp;</span> <span class="o">(</span><span class="nx">haystack</span><span class="o">[</span><span class="nx">NODE_TYPE</span><span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="nx">needle</span><span class="o">[</span><span class="nx">NODE_TYPE</span><span class="o">])</span> <span class="o">)</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span><span class="nx">haystack</span><span class="o">.</span><span class="nx">contains</span> <span class="o">&amp;&amp;</span> <span class="nx">haystack</span> <span class="o">!==</span> <span class="nx">needle</span><span class="o">)</span> <span class="o">{</span> <span class="c">// contains returns true when equal</span>
<span class="c"></span>                    <span class="nx">ret</span> <span class="o">=</span> <span class="nx">haystack</span><span class="o">.</span><span class="nx">contains</span><span class="o">(</span><span class="nx">needle</span><span class="o">);</span>
                <span class="o">}</span>
                <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">haystack</span><span class="o">.</span><span class="nx">compareDocumentPosition</span><span class="o">)</span> <span class="o">{</span> <span class="c">// gecko</span>
<span class="c"></span>                    <span class="nx">ret</span> <span class="o">=</span> <span class="o">!!(</span><span class="nx">haystack</span><span class="o">.</span><span class="nx">compareDocumentPosition</span><span class="o">(</span><span class="nx">needle</span><span class="o">)</span> <span class="o">&amp;</span> <span class="m">16</span><span class="o">);</span>
                <span class="o">}</span>
            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;isAncestor failed; invalid input: &#39;</span> <span class="o">+</span> <span class="nx">haystack</span> <span class="o">+</span> <span class="s1">&#39;,&#39;</span> <span class="o">+</span> <span class="nx">needle</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="o">}</span>
            <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;isAncestor(&#39;</span> <span class="o">+</span> <span class="nx">haystack</span> <span class="o">+</span> <span class="s1">&#39;,&#39;</span> <span class="o">+</span> <span class="nx">needle</span> <span class="o">+</span> <span class="s1">&#39; returning &#39;</span> <span class="o">+</span> <span class="nx">ret</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="k">return</span> <span class="nx">ret</span><span class="o">;</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Determines whether an HTMLElement is present in the current document.</span>
<span class="c">         * @method inDocument         </span>
<span class="c">         * @param {String | HTMLElement} el The element to search for</span>
<span class="c">         * @param {Object} doc An optional document to search, defaults to element&#39;s owner document </span>
<span class="c">         * @return {Boolean} Whether or not the element is present in the current document</span>
<span class="c">         */</span>
        <span class="nx">inDocument</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">doc</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_inDoc</span><span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">el</span><span class="o">),</span> <span class="nx">doc</span><span class="o">);</span>
        <span class="o">},</span>

        <span class="nx">_inDoc</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">doc</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">ret</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
            <span class="k">if</span> <span class="o">(</span><span class="nx">el</span> <span class="o">&amp;&amp;</span> <span class="nx">el</span><span class="o">[</span><span class="nx">TAG_NAME</span><span class="o">])</span> <span class="o">{</span>
                <span class="nx">doc</span> <span class="o">=</span> <span class="nx">doc</span> <span class="o">||</span> <span class="nx">el</span><span class="o">[</span><span class="nx">OWNER_DOCUMENT</span><span class="o">];</span> 
                <span class="nx">ret</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">isAncestor</span><span class="o">(</span><span class="nx">doc</span><span class="o">[</span><span class="nx">DOCUMENT_ELEMENT</span><span class="o">],</span> <span class="nx">el</span><span class="o">);</span>
            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;inDocument failed: invalid input&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="o">}</span>
            <span class="k">return</span> <span class="nx">ret</span><span class="o">;</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Returns a array of HTMLElements that pass the test applied by supplied boolean method.</span>
<span class="c">         * For optimized performance, include a tag and/or root node when possible.</span>
<span class="c">         * Note: This method operates against a live collection, so modifying the </span>
<span class="c">         * collection in the callback (removing/appending nodes, etc.) will have</span>
<span class="c">         * side effects.  Instead you should iterate the returned nodes array,</span>
<span class="c">         * as you would with the native &quot;getElementsByTagName&quot; method. </span>
<span class="c">         * @method getElementsBy</span>
<span class="c">         * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.</span>
<span class="c">         * @param {String} tag (optional) The tag name of the elements being collected</span>
<span class="c">         * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point </span>
<span class="c">         * @param {Function} apply (optional) A function to apply to each element when found </span>
<span class="c">         * @param {Any} o (optional) An optional arg that is passed to the supplied method</span>
<span class="c">         * @param {Boolean} overrides (optional) Whether or not to override the scope of &quot;method&quot; with &quot;o&quot;</span>
<span class="c">         * @return {Array} Array of HTMLElements</span>
<span class="c">         */</span>
        <span class="nx">getElementsBy</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">method</span><span class="o">,</span> <span class="nx">tag</span><span class="o">,</span> <span class="nx">root</span><span class="o">,</span> <span class="nx">apply</span><span class="o">,</span> <span class="nx">o</span><span class="o">,</span> <span class="nx">overrides</span><span class="o">,</span> <span class="nx">firstOnly</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">tag</span> <span class="o">=</span> <span class="nx">tag</span> <span class="o">||</span> <span class="s1">&#39;*&#39;</span><span class="o">;</span>
            <span class="nx">root</span> <span class="o">=</span> <span class="o">(</span><span class="nx">root</span><span class="o">)</span> <span class="o">?</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">root</span><span class="o">)</span> <span class="o">:</span> <span class="kc">null</span> <span class="o">||</span> <span class="nb">document</span><span class="o">;</span> 

            <span class="k">if</span> <span class="o">(!</span><span class="nx">root</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">return</span> <span class="o">[];</span>
            <span class="o">}</span>

            <span class="k">var</span> <span class="nx">nodes</span> <span class="o">=</span> <span class="o">[],</span>
                <span class="nx">elements</span> <span class="o">=</span> <span class="nx">root</span><span class="o">.</span><span class="nx">getElementsByTagName</span><span class="o">(</span><span class="nx">tag</span><span class="o">);</span>
            
            <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="m">0</span><span class="o">,</span> <span class="nx">len</span> <span class="o">=</span> <span class="nx">elements</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">len</span><span class="o">;</span> <span class="o">++</span><span class="nx">i</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span> <span class="nx">method</span><span class="o">(</span><span class="nx">elements</span><span class="o">[</span><span class="nx">i</span><span class="o">])</span> <span class="o">)</span> <span class="o">{</span>
                    <span class="k">if</span> <span class="o">(</span><span class="nx">firstOnly</span><span class="o">)</span> <span class="o">{</span>
                        <span class="nx">nodes</span> <span class="o">=</span> <span class="nx">elements</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span> 
                        <span class="k">break</span><span class="o">;</span>
                    <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                        <span class="nx">nodes</span><span class="o">[</span><span class="nx">nodes</span><span class="o">.</span><span class="nx">length</span><span class="o">]</span> <span class="o">=</span> <span class="nx">elements</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
                    <span class="o">}</span>
                <span class="o">}</span>
            <span class="o">}</span>

            <span class="k">if</span> <span class="o">(</span><span class="nx">apply</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">batch</span><span class="o">(</span><span class="nx">nodes</span><span class="o">,</span> <span class="nx">apply</span><span class="o">,</span> <span class="nx">o</span><span class="o">,</span> <span class="nx">overrides</span><span class="o">);</span>
            <span class="o">}</span>

            <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getElementsBy returning &#39;</span> <span class="o">+</span> <span class="nx">nodes</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            
            <span class="k">return</span> <span class="nx">nodes</span><span class="o">;</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Returns the first HTMLElement that passes the test applied by the supplied boolean method.</span>
<span class="c">         * @method getElementBy</span>
<span class="c">         * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.</span>
<span class="c">         * @param {String} tag (optional) The tag name of the elements being collected</span>
<span class="c">         * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point </span>
<span class="c">         * @return {HTMLElement}</span>
<span class="c">         */</span>
        <span class="nx">getElementBy</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">method</span><span class="o">,</span> <span class="nx">tag</span><span class="o">,</span> <span class="nx">root</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getElementsBy</span><span class="o">(</span><span class="nx">method</span><span class="o">,</span> <span class="nx">tag</span><span class="o">,</span> <span class="nx">root</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span> 
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Runs the supplied method against each item in the Collection/Array.</span>
<span class="c">         * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).</span>
<span class="c">         * @method batch</span>
<span class="c">         * @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to</span>
<span class="c">         * @param {Function} method The method to apply to the element(s)</span>
<span class="c">         * @param {Any} o (optional) An optional arg that is passed to the supplied method</span>
<span class="c">         * @param {Boolean} overrides (optional) Whether or not to override the scope of &quot;method&quot; with &quot;o&quot;</span>
<span class="c">         * @return {Any | Array} The return value(s) from the supplied method</span>
<span class="c">         */</span>
        <span class="nx">batch</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">method</span><span class="o">,</span> <span class="nx">o</span><span class="o">,</span> <span class="nx">overrides</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">collection</span> <span class="o">=</span> <span class="o">[],</span>
                <span class="nx">scope</span> <span class="o">=</span> <span class="o">(</span><span class="nx">overrides</span><span class="o">)</span> <span class="o">?</span> <span class="nx">o</span> <span class="o">:</span> <span class="nb">window</span><span class="o">;</span>
                
            <span class="nx">el</span> <span class="o">=</span> <span class="o">(</span><span class="nx">el</span> <span class="o">&amp;&amp;</span> <span class="o">(</span><span class="nx">el</span><span class="o">[</span><span class="nx">TAG_NAME</span><span class="o">]</span> <span class="o">||</span> <span class="nx">el</span><span class="o">.</span><span class="nx">item</span><span class="o">))</span> <span class="o">?</span> <span class="nx">el</span> <span class="o">:</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">el</span><span class="o">);</span> <span class="c">// skip get() when possible</span>
<span class="c"></span>            <span class="k">if</span> <span class="o">(</span><span class="nx">el</span> <span class="o">&amp;&amp;</span> <span class="nx">method</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span><span class="nx">el</span><span class="o">[</span><span class="nx">TAG_NAME</span><span class="o">]</span> <span class="o">||</span> <span class="nx">el</span><span class="o">.</span><span class="nx">length</span> <span class="o">===</span> <span class="kc">undefined</span><span class="o">)</span> <span class="o">{</span> <span class="c">// element or not array-like </span>
<span class="c"></span>                    <span class="k">return</span> <span class="nx">method</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="nx">scope</span><span class="o">,</span> <span class="nx">el</span><span class="o">,</span> <span class="nx">o</span><span class="o">);</span>
                <span class="o">}</span> 

                <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">el</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="o">++</span><span class="nx">i</span><span class="o">)</span> <span class="o">{</span>
                    <span class="nx">collection</span><span class="o">[</span><span class="nx">collection</span><span class="o">.</span><span class="nx">length</span><span class="o">]</span> <span class="o">=</span> <span class="nx">method</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="nx">scope</span><span class="o">,</span> <span class="nx">el</span><span class="o">[</span><span class="nx">i</span><span class="o">],</span> <span class="nx">o</span><span class="o">);</span>
                <span class="o">}</span>
            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;batch called with invalid arguments&#39;</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
            <span class="o">}</span> 
            <span class="k">return</span> <span class="nx">collection</span><span class="o">;</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Returns the height of the document.</span>
<span class="c">         * @method getDocumentHeight</span>
<span class="c">         * @return {Int} The height of the actual document (which includes the body and its margin).</span>
<span class="c">         */</span>
        <span class="nx">getDocumentHeight</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">scrollHeight</span> <span class="o">=</span> <span class="o">(</span><span class="nb">document</span><span class="o">[</span><span class="nx">COMPAT_MODE</span><span class="o">]</span> <span class="o">!=</span> <span class="nx">CSS1_COMPAT</span> <span class="o">||</span> <span class="nx">isSafari</span><span class="o">)</span> <span class="o">?</span> <span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">scrollHeight</span> <span class="o">:</span> <span class="nx">documentElement</span><span class="o">.</span><span class="nx">scrollHeight</span><span class="o">,</span>
                <span class="nx">h</span> <span class="o">=</span> <span class="nb">Math</span><span class="o">.</span><span class="nx">max</span><span class="o">(</span><span class="nx">scrollHeight</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getViewportHeight</span><span class="o">());</span>

            <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getDocumentHeight returning &#39;</span> <span class="o">+</span> <span class="nx">h</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="k">return</span> <span class="nx">h</span><span class="o">;</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Returns the width of the document.</span>
<span class="c">         * @method getDocumentWidth</span>
<span class="c">         * @return {Int} The width of the actual document (which includes the body and its margin).</span>
<span class="c">         */</span>
        <span class="nx">getDocumentWidth</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">scrollWidth</span> <span class="o">=</span> <span class="o">(</span><span class="nb">document</span><span class="o">[</span><span class="nx">COMPAT_MODE</span><span class="o">]</span> <span class="o">!=</span> <span class="nx">CSS1_COMPAT</span> <span class="o">||</span> <span class="nx">isSafari</span><span class="o">)</span> <span class="o">?</span> <span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">scrollWidth</span> <span class="o">:</span> <span class="nx">documentElement</span><span class="o">.</span><span class="nx">scrollWidth</span><span class="o">,</span>
                <span class="nx">w</span> <span class="o">=</span> <span class="nb">Math</span><span class="o">.</span><span class="nx">max</span><span class="o">(</span><span class="nx">scrollWidth</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getViewportWidth</span><span class="o">());</span>
            <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getDocumentWidth returning &#39;</span> <span class="o">+</span> <span class="nx">w</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="k">return</span> <span class="nx">w</span><span class="o">;</span>
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Returns the current height of the viewport.</span>
<span class="c">         * @method getViewportHeight</span>
<span class="c">         * @return {Int} The height of the viewable area of the page (excludes scrollbars).</span>
<span class="c">         */</span>
        <span class="nx">getViewportHeight</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">height</span> <span class="o">=</span> <span class="nx">self</span><span class="o">.</span><span class="nx">innerHeight</span><span class="o">,</span> <span class="c">// Safari, Opera</span>
<span class="c"></span>                <span class="nx">mode</span> <span class="o">=</span> <span class="nb">document</span><span class="o">[</span><span class="nx">COMPAT_MODE</span><span class="o">];</span>
        
            <span class="k">if</span> <span class="o">(</span> <span class="o">(</span><span class="nx">mode</span> <span class="o">||</span> <span class="nx">isIE</span><span class="o">)</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">isOpera</span> <span class="o">)</span> <span class="o">{</span> <span class="c">// IE, Gecko</span>
<span class="c"></span>                <span class="nx">height</span> <span class="o">=</span> <span class="o">(</span><span class="nx">mode</span> <span class="o">==</span> <span class="nx">CSS1_COMPAT</span><span class="o">)</span> <span class="o">?</span>
                        <span class="nx">documentElement</span><span class="o">.</span><span class="nx">clientHeight</span> <span class="o">:</span> <span class="c">// Standards</span>
<span class="c"></span>                        <span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">clientHeight</span><span class="o">;</span> <span class="c">// Quirks</span>
<span class="c"></span>            <span class="o">}</span>
        
            <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getViewportHeight returning &#39;</span> <span class="o">+</span> <span class="nx">height</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="k">return</span> <span class="nx">height</span><span class="o">;</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Returns the current width of the viewport.</span>
<span class="c">         * @method getViewportWidth</span>
<span class="c">         * @return {Int} The width of the viewable area of the page (excludes scrollbars).</span>
<span class="c">         */</span>
        
        <span class="nx">getViewportWidth</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">width</span> <span class="o">=</span> <span class="nx">self</span><span class="o">.</span><span class="nx">innerWidth</span><span class="o">,</span>  <span class="c">// Safari</span>
<span class="c"></span>                <span class="nx">mode</span> <span class="o">=</span> <span class="nb">document</span><span class="o">[</span><span class="nx">COMPAT_MODE</span><span class="o">];</span>
            
            <span class="k">if</span> <span class="o">(</span><span class="nx">mode</span> <span class="o">||</span> <span class="nx">isIE</span><span class="o">)</span> <span class="o">{</span> <span class="c">// IE, Gecko, Opera</span>
<span class="c"></span>                <span class="nx">width</span> <span class="o">=</span> <span class="o">(</span><span class="nx">mode</span> <span class="o">==</span> <span class="nx">CSS1_COMPAT</span><span class="o">)</span> <span class="o">?</span>
                        <span class="nx">documentElement</span><span class="o">.</span><span class="nx">clientWidth</span> <span class="o">:</span> <span class="c">// Standards</span>
<span class="c"></span>                        <span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">clientWidth</span><span class="o">;</span> <span class="c">// Quirks</span>
<span class="c"></span>            <span class="o">}</span>
            <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getViewportWidth returning &#39;</span> <span class="o">+</span> <span class="nx">width</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="k">return</span> <span class="nx">width</span><span class="o">;</span>
        <span class="o">},</span>

       <span class="c">/**</span>
<span class="c">         * Returns the nearest ancestor that passes the test applied by supplied boolean method.</span>
<span class="c">         * For performance reasons, IDs are not accepted and argument validation omitted.</span>
<span class="c">         * @method getAncestorBy</span>
<span class="c">         * @param {HTMLElement} node The HTMLElement to use as the starting point </span>
<span class="c">         * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.</span>
<span class="c">         * @return {Object} HTMLElement or null if not found</span>
<span class="c">         */</span>
        <span class="nx">getAncestorBy</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">while</span> <span class="o">(</span> <span class="o">(</span><span class="nx">node</span> <span class="o">=</span> <span class="nx">node</span><span class="o">[</span><span class="nx">PARENT_NODE</span><span class="o">])</span> <span class="o">)</span> <span class="o">{</span> <span class="c">// NOTE: assignment</span>
<span class="c"></span>                <span class="k">if</span> <span class="o">(</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_testElement</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
                    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getAncestorBy returning &#39;</span> <span class="o">+</span> <span class="nx">node</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                    <span class="k">return</span> <span class="nx">node</span><span class="o">;</span>
                <span class="o">}</span>
            <span class="o">}</span> 

            <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getAncestorBy returning null (no ancestor passed test)&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
        <span class="o">},</span>
        
        <span class="c">/**</span>
<span class="c">         * Returns the nearest ancestor with the given className.</span>
<span class="c">         * @method getAncestorByClassName</span>
<span class="c">         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point </span>
<span class="c">         * @param {String} className</span>
<span class="c">         * @return {Object} HTMLElement</span>
<span class="c">         */</span>
        <span class="nx">getAncestorByClassName</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">node</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
            <span class="k">if</span> <span class="o">(!</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getAncestorByClassName failed: invalid node argument&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
            <span class="o">}</span>
            <span class="k">var</span> <span class="nx">method</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span> <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">hasClass</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">className</span><span class="o">);</span> <span class="o">};</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getAncestorBy</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">);</span>
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Returns the nearest ancestor with the given tagName.</span>
<span class="c">         * @method getAncestorByTagName</span>
<span class="c">         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point </span>
<span class="c">         * @param {String} tagName</span>
<span class="c">         * @return {Object} HTMLElement</span>
<span class="c">         */</span>
        <span class="nx">getAncestorByTagName</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">tagName</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">node</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
            <span class="k">if</span> <span class="o">(!</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getAncestorByTagName failed: invalid node argument&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
            <span class="o">}</span>
            <span class="k">var</span> <span class="nx">method</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
                 <span class="k">return</span> <span class="nx">el</span><span class="o">[</span><span class="nx">TAG_NAME</span><span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="nx">el</span><span class="o">[</span><span class="nx">TAG_NAME</span><span class="o">].</span><span class="nx">toUpperCase</span><span class="o">()</span> <span class="o">==</span> <span class="nx">tagName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">();</span>
            <span class="o">};</span>

            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getAncestorBy</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">);</span>
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Returns the previous sibling that is an HTMLElement. </span>
<span class="c">         * For performance reasons, IDs are not accepted and argument validation omitted.</span>
<span class="c">         * Returns the nearest HTMLElement sibling if no method provided.</span>
<span class="c">         * @method getPreviousSiblingBy</span>
<span class="c">         * @param {HTMLElement} node The HTMLElement to use as the starting point </span>
<span class="c">         * @param {Function} method A boolean function used to test siblings</span>
<span class="c">         * that receives the sibling node being tested as its only argument</span>
<span class="c">         * @return {Object} HTMLElement or null if not found</span>
<span class="c">         */</span>
        <span class="nx">getPreviousSiblingBy</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">while</span> <span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">node</span> <span class="o">=</span> <span class="nx">node</span><span class="o">.</span><span class="nx">previousSibling</span><span class="o">;</span>
                <span class="k">if</span> <span class="o">(</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_testElement</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
                    <span class="k">return</span> <span class="nx">node</span><span class="o">;</span>
                <span class="o">}</span>
            <span class="o">}</span>
            <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
        <span class="o">},</span> 

        <span class="c">/**</span>
<span class="c">         * Returns the previous sibling that is an HTMLElement </span>
<span class="c">         * @method getPreviousSibling</span>
<span class="c">         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point </span>
<span class="c">         * @return {Object} HTMLElement or null if not found</span>
<span class="c">         */</span>
        <span class="nx">getPreviousSibling</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">node</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
            <span class="k">if</span> <span class="o">(!</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getPreviousSibling failed: invalid node argument&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
            <span class="o">}</span>

            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getPreviousSiblingBy</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
        <span class="o">},</span> 

        <span class="c">/**</span>
<span class="c">         * Returns the next HTMLElement sibling that passes the boolean method. </span>
<span class="c">         * For performance reasons, IDs are not accepted and argument validation omitted.</span>
<span class="c">         * Returns the nearest HTMLElement sibling if no method provided.</span>
<span class="c">         * @method getNextSiblingBy</span>
<span class="c">         * @param {HTMLElement} node The HTMLElement to use as the starting point </span>
<span class="c">         * @param {Function} method A boolean function used to test siblings</span>
<span class="c">         * that receives the sibling node being tested as its only argument</span>
<span class="c">         * @return {Object} HTMLElement or null if not found</span>
<span class="c">         */</span>
        <span class="nx">getNextSiblingBy</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">while</span> <span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">node</span> <span class="o">=</span> <span class="nx">node</span><span class="o">.</span><span class="nx">nextSibling</span><span class="o">;</span>
                <span class="k">if</span> <span class="o">(</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_testElement</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
                    <span class="k">return</span> <span class="nx">node</span><span class="o">;</span>
                <span class="o">}</span>
            <span class="o">}</span>
            <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
        <span class="o">},</span> 

        <span class="c">/**</span>
<span class="c">         * Returns the next sibling that is an HTMLElement </span>
<span class="c">         * @method getNextSibling</span>
<span class="c">         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point </span>
<span class="c">         * @return {Object} HTMLElement or null if not found</span>
<span class="c">         */</span>
        <span class="nx">getNextSibling</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">node</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
            <span class="k">if</span> <span class="o">(!</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getNextSibling failed: invalid node argument&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
            <span class="o">}</span>

            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getNextSiblingBy</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
        <span class="o">},</span> 

        <span class="c">/**</span>
<span class="c">         * Returns the first HTMLElement child that passes the test method. </span>
<span class="c">         * @method getFirstChildBy</span>
<span class="c">         * @param {HTMLElement} node The HTMLElement to use as the starting point </span>
<span class="c">         * @param {Function} method A boolean function used to test children</span>
<span class="c">         * that receives the node being tested as its only argument</span>
<span class="c">         * @return {Object} HTMLElement or null if not found</span>
<span class="c">         */</span>
        <span class="nx">getFirstChildBy</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">child</span> <span class="o">=</span> <span class="o">(</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_testElement</span><span class="o">(</span><span class="nx">node</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">)</span> <span class="o">?</span> <span class="nx">node</span><span class="o">.</span><span class="nx">firstChild</span> <span class="o">:</span> <span class="kc">null</span><span class="o">;</span>
            <span class="k">return</span> <span class="nx">child</span> <span class="o">||</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getNextSiblingBy</span><span class="o">(</span><span class="nx">node</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">,</span> <span class="nx">method</span><span class="o">);</span>
        <span class="o">},</span> 

        <span class="c">/**</span>
<span class="c">         * Returns the first HTMLElement child. </span>
<span class="c">         * @method getFirstChild</span>
<span class="c">         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point </span>
<span class="c">         * @return {Object} HTMLElement or null if not found</span>
<span class="c">         */</span>
        <span class="nx">getFirstChild</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">node</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
            <span class="k">if</span> <span class="o">(!</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getFirstChild failed: invalid node argument&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
            <span class="o">}</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getFirstChildBy</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
        <span class="o">},</span> 

        <span class="c">/**</span>
<span class="c">         * Returns the last HTMLElement child that passes the test method. </span>
<span class="c">         * @method getLastChildBy</span>
<span class="c">         * @param {HTMLElement} node The HTMLElement to use as the starting point </span>
<span class="c">         * @param {Function} method A boolean function used to test children</span>
<span class="c">         * that receives the node being tested as its only argument</span>
<span class="c">         * @return {Object} HTMLElement or null if not found</span>
<span class="c">         */</span>
        <span class="nx">getLastChildBy</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">if</span> <span class="o">(!</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getLastChild failed: invalid node argument&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
            <span class="o">}</span>
            <span class="k">var</span> <span class="nx">child</span> <span class="o">=</span> <span class="o">(</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_testElement</span><span class="o">(</span><span class="nx">node</span><span class="o">.</span><span class="nx">lastChild</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">)</span> <span class="o">?</span> <span class="nx">node</span><span class="o">.</span><span class="nx">lastChild</span> <span class="o">:</span> <span class="kc">null</span><span class="o">;</span>
            <span class="k">return</span> <span class="nx">child</span> <span class="o">||</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getPreviousSiblingBy</span><span class="o">(</span><span class="nx">node</span><span class="o">.</span><span class="nx">lastChild</span><span class="o">,</span> <span class="nx">method</span><span class="o">);</span>
        <span class="o">},</span> 

        <span class="c">/**</span>
<span class="c">         * Returns the last HTMLElement child. </span>
<span class="c">         * @method getLastChild</span>
<span class="c">         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point </span>
<span class="c">         * @return {Object} HTMLElement or null if not found</span>
<span class="c">         */</span>
        <span class="nx">getLastChild</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">node</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getLastChildBy</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
        <span class="o">},</span> 

        <span class="c">/**</span>
<span class="c">         * Returns an array of HTMLElement childNodes that pass the test method. </span>
<span class="c">         * @method getChildrenBy</span>
<span class="c">         * @param {HTMLElement} node The HTMLElement to start from</span>
<span class="c">         * @param {Function} method A boolean function used to test children</span>
<span class="c">         * that receives the node being tested as its only argument</span>
<span class="c">         * @return {Array} A static array of HTMLElements</span>
<span class="c">         */</span>
        <span class="nx">getChildrenBy</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">child</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getFirstChildBy</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">),</span>
                <span class="nx">children</span> <span class="o">=</span> <span class="nx">child</span> <span class="o">?</span> <span class="o">[</span><span class="nx">child</span><span class="o">]</span> <span class="o">:</span> <span class="o">[];</span>

            <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getNextSiblingBy</span><span class="o">(</span><span class="nx">child</span><span class="o">,</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span> <span class="o">!</span><span class="nx">method</span> <span class="o">||</span> <span class="nx">method</span><span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
                    <span class="nx">children</span><span class="o">[</span><span class="nx">children</span><span class="o">.</span><span class="nx">length</span><span class="o">]</span> <span class="o">=</span> <span class="nx">node</span><span class="o">;</span>
                <span class="o">}</span>
                <span class="k">return</span> <span class="kc">false</span><span class="o">;</span> <span class="c">// fail test to collect all children</span>
<span class="c"></span>            <span class="o">});</span>

            <span class="k">return</span> <span class="nx">children</span><span class="o">;</span>
        <span class="o">},</span>
 
        <span class="c">/**</span>
<span class="c">         * Returns an array of HTMLElement childNodes. </span>
<span class="c">         * @method getChildren</span>
<span class="c">         * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point </span>
<span class="c">         * @return {Array} A static array of HTMLElements</span>
<span class="c">         */</span>
        <span class="nx">getChildren</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">node</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
            <span class="k">if</span> <span class="o">(!</span><span class="nx">node</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;getChildren failed: invalid node argument&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
            <span class="o">}</span>

            <span class="k">return</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getChildrenBy</span><span class="o">(</span><span class="nx">node</span><span class="o">);</span>
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Returns the left scroll value of the document </span>
<span class="c">         * @method getDocumentScrollLeft</span>
<span class="c">         * @param {HTMLDocument} document (optional) The document to get the scroll value of</span>
<span class="c">         * @return {Int}  The amount that the document is scrolled to the left</span>
<span class="c">         */</span>
        <span class="nx">getDocumentScrollLeft</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">doc</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">doc</span> <span class="o">=</span> <span class="nx">doc</span> <span class="o">||</span> <span class="nb">document</span><span class="o">;</span>
            <span class="k">return</span> <span class="nb">Math</span><span class="o">.</span><span class="nx">max</span><span class="o">(</span><span class="nx">doc</span><span class="o">[</span><span class="nx">DOCUMENT_ELEMENT</span><span class="o">].</span><span class="nx">scrollLeft</span><span class="o">,</span> <span class="nx">doc</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">scrollLeft</span><span class="o">);</span>
        <span class="o">},</span> 

        <span class="c">/**</span>
<span class="c">         * Returns the top scroll value of the document </span>
<span class="c">         * @method getDocumentScrollTop</span>
<span class="c">         * @param {HTMLDocument} document (optional) The document to get the scroll value of</span>
<span class="c">         * @return {Int}  The amount that the document is scrolled to the top</span>
<span class="c">         */</span>
        <span class="nx">getDocumentScrollTop</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">doc</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">doc</span> <span class="o">=</span> <span class="nx">doc</span> <span class="o">||</span> <span class="nb">document</span><span class="o">;</span>
            <span class="k">return</span> <span class="nb">Math</span><span class="o">.</span><span class="nx">max</span><span class="o">(</span><span class="nx">doc</span><span class="o">[</span><span class="nx">DOCUMENT_ELEMENT</span><span class="o">].</span><span class="nx">scrollTop</span><span class="o">,</span> <span class="nx">doc</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">scrollTop</span><span class="o">);</span>
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Inserts the new node as the previous sibling of the reference node </span>
<span class="c">         * @method insertBefore</span>
<span class="c">         * @param {String | HTMLElement} newNode The node to be inserted</span>
<span class="c">         * @param {String | HTMLElement} referenceNode The node to insert the new node before </span>
<span class="c">         * @return {HTMLElement} The node that was inserted (or null if insert fails) </span>
<span class="c">         */</span>
        <span class="nx">insertBefore</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">newNode</span><span class="o">,</span> <span class="nx">referenceNode</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">newNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">newNode</span><span class="o">);</span> 
            <span class="nx">referenceNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">referenceNode</span><span class="o">);</span> 
            
            <span class="k">if</span> <span class="o">(!</span><span class="nx">newNode</span> <span class="o">||</span> <span class="o">!</span><span class="nx">referenceNode</span> <span class="o">||</span> <span class="o">!</span><span class="nx">referenceNode</span><span class="o">[</span><span class="nx">PARENT_NODE</span><span class="o">])</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;insertAfter failed: missing or invalid arg(s)&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
            <span class="o">}</span>       

            <span class="k">return</span> <span class="nx">referenceNode</span><span class="o">[</span><span class="nx">PARENT_NODE</span><span class="o">].</span><span class="nx">insertBefore</span><span class="o">(</span><span class="nx">newNode</span><span class="o">,</span> <span class="nx">referenceNode</span><span class="o">);</span> 
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Inserts the new node as the next sibling of the reference node </span>
<span class="c">         * @method insertAfter</span>
<span class="c">         * @param {String | HTMLElement} newNode The node to be inserted</span>
<span class="c">         * @param {String | HTMLElement} referenceNode The node to insert the new node after </span>
<span class="c">         * @return {HTMLElement} The node that was inserted (or null if insert fails) </span>
<span class="c">         */</span>
        <span class="nx">insertAfter</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">newNode</span><span class="o">,</span> <span class="nx">referenceNode</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">newNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">newNode</span><span class="o">);</span> 
            <span class="nx">referenceNode</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">referenceNode</span><span class="o">);</span> 
            
            <span class="k">if</span> <span class="o">(!</span><span class="nx">newNode</span> <span class="o">||</span> <span class="o">!</span><span class="nx">referenceNode</span> <span class="o">||</span> <span class="o">!</span><span class="nx">referenceNode</span><span class="o">[</span><span class="nx">PARENT_NODE</span><span class="o">])</span> <span class="o">{</span>
                <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;insertAfter failed: missing or invalid arg(s)&#39;</span><span class="o">,</span> <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Dom&#39;</span><span class="o">);</span>
                <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
            <span class="o">}</span>       

            <span class="k">if</span> <span class="o">(</span><span class="nx">referenceNode</span><span class="o">.</span><span class="nx">nextSibling</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">return</span> <span class="nx">referenceNode</span><span class="o">[</span><span class="nx">PARENT_NODE</span><span class="o">].</span><span class="nx">insertBefore</span><span class="o">(</span><span class="nx">newNode</span><span class="o">,</span> <span class="nx">referenceNode</span><span class="o">.</span><span class="nx">nextSibling</span><span class="o">);</span> 
            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                <span class="k">return</span> <span class="nx">referenceNode</span><span class="o">[</span><span class="nx">PARENT_NODE</span><span class="o">].</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">newNode</span><span class="o">);</span>
            <span class="o">}</span>
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Creates a Region based on the viewport relative to the document. </span>
<span class="c">         * @method getClientRegion</span>
<span class="c">         * @return {Region} A Region object representing the viewport which accounts for document scroll</span>
<span class="c">         */</span>
        <span class="nx">getClientRegion</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">t</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getDocumentScrollTop</span><span class="o">(),</span>
                <span class="nx">l</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getDocumentScrollLeft</span><span class="o">(),</span>
                <span class="nx">r</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getViewportWidth</span><span class="o">()</span> <span class="o">+</span> <span class="nx">l</span><span class="o">,</span>
                <span class="nx">b</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getViewportHeight</span><span class="o">()</span> <span class="o">+</span> <span class="nx">t</span><span class="o">;</span>

            <span class="k">return</span> <span class="k">new</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Region</span><span class="o">(</span><span class="nx">t</span><span class="o">,</span> <span class="nx">r</span><span class="o">,</span> <span class="nx">b</span><span class="o">,</span> <span class="nx">l</span><span class="o">);</span>
        <span class="o">},</span>

        <span class="c">/**</span>
<span class="c">         * Provides a normalized attribute interface. </span>
<span class="c">         * @method setAttibute</span>
<span class="c">         * @param {String | HTMLElement} el The target element for the attribute.</span>
<span class="c">         * @param {String} attr The attribute to set.</span>
<span class="c">         * @param {String} val The value of the attribute.</span>
<span class="c">         */</span>
        <span class="nx">setAttribute</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">attr</span><span class="o">,</span> <span class="nx">val</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">attr</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">CUSTOM_ATTRIBUTES</span><span class="o">[</span><span class="nx">attr</span><span class="o">]</span> <span class="o">||</span> <span class="nx">attr</span><span class="o">;</span>
            <span class="nx">el</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="nx">attr</span><span class="o">,</span> <span class="nx">val</span><span class="o">);</span>
        <span class="o">},</span>


        <span class="c">/**</span>
<span class="c">         * Provides a normalized attribute interface. </span>
<span class="c">         * @method getAttibute</span>
<span class="c">         * @param {String | HTMLElement} el The target element for the attribute.</span>
<span class="c">         * @param {String} attr The attribute to get.</span>
<span class="c">         * @return {String} The current value of the attribute. </span>
<span class="c">         */</span>
        <span class="nx">getAttribute</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">attr</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">attr</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">CUSTOM_ATTRIBUTES</span><span class="o">[</span><span class="nx">attr</span><span class="o">]</span> <span class="o">||</span> <span class="nx">attr</span><span class="o">;</span>
            <span class="k">return</span> <span class="nx">el</span><span class="o">.</span><span class="nx">getAttribute</span><span class="o">(</span><span class="nx">attr</span><span class="o">);</span>
        <span class="o">},</span>

        <span class="nx">_toCamel</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">property</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">c</span> <span class="o">=</span> <span class="nx">propertyCache</span><span class="o">;</span>

            <span class="k">function</span> <span class="nx">tU</span><span class="o">(</span><span class="nx">x</span><span class="o">,</span><span class="nx">l</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">return</span> <span class="nx">l</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">();</span>
            <span class="o">}</span>

            <span class="k">return</span> <span class="nx">c</span><span class="o">[</span><span class="nx">property</span><span class="o">]</span> <span class="o">||</span> <span class="o">(</span><span class="nx">c</span><span class="o">[</span><span class="nx">property</span><span class="o">]</span> <span class="o">=</span> <span class="nx">property</span><span class="o">.</span><span class="nx">indexOf</span><span class="o">(</span><span class="s1">&#39;-&#39;</span><span class="o">)</span> <span class="o">===</span> <span class="o">-</span><span class="m">1</span> <span class="o">?</span> 
                                    <span class="nx">property</span> <span class="o">:</span>
                                    <span class="nx">property</span><span class="o">.</span><span class="nx">replace</span><span class="o">(</span> <span class="sr">/-([a-z])/gi</span><span class="o">,</span> <span class="nx">tU</span> <span class="o">));</span>
        <span class="o">},</span>

        <span class="nx">_getClassRegex</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">re</span><span class="o">;</span>
            <span class="k">if</span> <span class="o">(</span><span class="nx">className</span> <span class="o">!==</span> <span class="kc">undefined</span><span class="o">)</span> <span class="o">{</span> <span class="c">// allow empty string to pass</span>
<span class="c"></span>                <span class="k">if</span> <span class="o">(</span><span class="nx">className</span><span class="o">.</span><span class="nx">exec</span><span class="o">)</span> <span class="o">{</span> <span class="c">// already a RegExp</span>
<span class="c"></span>                    <span class="nx">re</span> <span class="o">=</span> <span class="nx">className</span><span class="o">;</span>
                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
                    <span class="nx">re</span> <span class="o">=</span> <span class="nx">reCache</span><span class="o">[</span><span class="nx">className</span><span class="o">];</span>
                    <span class="k">if</span> <span class="o">(!</span><span class="nx">re</span><span class="o">)</span> <span class="o">{</span>
                        <span class="c">// escape special chars (&quot;.&quot;, &quot;[&quot;, etc.)</span>
<span class="c"></span>                        <span class="nx">className</span> <span class="o">=</span> <span class="nx">className</span><span class="o">.</span><span class="nx">replace</span><span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">_patterns</span><span class="o">.</span><span class="nx">CLASS_RE_TOKENS</span><span class="o">,</span> <span class="s1">&#39;\\$1&#39;</span><span class="o">);</span>
                        <span class="nx">re</span> <span class="o">=</span> <span class="nx">reCache</span><span class="o">[</span><span class="nx">className</span><span class="o">]</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">RegExp</span><span class="o">(</span><span class="nx">C_START</span> <span class="o">+</span> <span class="nx">className</span> <span class="o">+</span> <span class="nx">C_END</span><span class="o">,</span> <span class="nx">G</span><span class="o">);</span>
                    <span class="o">}</span>
                <span class="o">}</span>
            <span class="o">}</span>
            <span class="k">return</span> <span class="nx">re</span><span class="o">;</span>
        <span class="o">},</span>

        <span class="nx">_patterns</span><span class="o">:</span> <span class="o">{</span>
            <span class="nx">ROOT_TAG</span><span class="o">:</span> <span class="sr">/^body|html$/i</span><span class="o">,</span> <span class="c">// body for quirks mode, html for standards,</span>
<span class="c"></span>            <span class="nx">CLASS_RE_TOKENS</span><span class="o">:</span> <span class="sr">/([\.\(\)\^\$\*\+\?\|\[\]\{\}])/g</span>
        <span class="o">},</span>


        <span class="nx">_testElement</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">method</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">node</span> <span class="o">&amp;&amp;</span> <span class="nx">node</span><span class="o">[</span><span class="nx">NODE_TYPE</span><span class="o">]</span> <span class="o">==</span> <span class="m">1</span> <span class="o">&amp;&amp;</span> <span class="o">(</span> <span class="o">!</span><span class="nx">method</span> <span class="o">||</span> <span class="nx">method</span><span class="o">(</span><span class="nx">node</span><span class="o">)</span> <span class="o">);</span>
        <span class="o">},</span>

        <span class="nx">_calcBorders</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">xy2</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">t</span> <span class="o">=</span> <span class="nb">parseInt</span><span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">[</span><span class="nx">GET_COMPUTED_STYLE</span><span class="o">](</span><span class="nx">node</span><span class="o">,</span> <span class="nx">BORDER_TOP_WIDTH</span><span class="o">),</span> <span class="m">10</span><span class="o">)</span> <span class="o">||</span> <span class="m">0</span><span class="o">,</span>
                <span class="nx">l</span> <span class="o">=</span> <span class="nb">parseInt</span><span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">[</span><span class="nx">GET_COMPUTED_STYLE</span><span class="o">](</span><span class="nx">node</span><span class="o">,</span> <span class="nx">BORDER_LEFT_WIDTH</span><span class="o">),</span> <span class="m">10</span><span class="o">)</span> <span class="o">||</span> <span class="m">0</span><span class="o">;</span>
            <span class="k">if</span> <span class="o">(</span><span class="nx">isGecko</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span><span class="nx">RE_TABLE</span><span class="o">.</span><span class="nx">test</span><span class="o">(</span><span class="nx">node</span><span class="o">[</span><span class="nx">TAG_NAME</span><span class="o">]))</span> <span class="o">{</span>
                    <span class="nx">t</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>
                    <span class="nx">l</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>
                <span class="o">}</span>
            <span class="o">}</span>
            <span class="nx">xy2</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">+=</span> <span class="nx">l</span><span class="o">;</span>
            <span class="nx">xy2</span><span class="o">[</span><span class="m">1</span><span class="o">]</span> <span class="o">+=</span> <span class="nx">t</span><span class="o">;</span>
            <span class="k">return</span> <span class="nx">xy2</span><span class="o">;</span>
        <span class="o">}</span>
    <span class="o">};</span>
        
    <span class="k">var</span> <span class="nx">_getComputedStyle</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">[</span><span class="nx">GET_COMPUTED_STYLE</span><span class="o">];</span>
    <span class="c">// fix opera computedStyle default color unit (convert to rgb)</span>
<span class="c"></span>    <span class="k">if</span> <span class="o">(</span><span class="nx">UA</span><span class="o">.</span><span class="nx">opera</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">[</span><span class="nx">GET_COMPUTED_STYLE</span><span class="o">]</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">att</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">val</span> <span class="o">=</span> <span class="nx">_getComputedStyle</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">att</span><span class="o">);</span>
            <span class="k">if</span> <span class="o">(</span><span class="nx">RE_COLOR</span><span class="o">.</span><span class="nx">test</span><span class="o">(</span><span class="nx">att</span><span class="o">))</span> <span class="o">{</span>
                <span class="nx">val</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">Color</span><span class="o">.</span><span class="nx">toRGB</span><span class="o">(</span><span class="nx">val</span><span class="o">);</span>
            <span class="o">}</span>

            <span class="k">return</span> <span class="nx">val</span><span class="o">;</span>
        <span class="o">};</span>

    <span class="o">}</span>

    <span class="c">// safari converts transparent to rgba(), others use &quot;transparent&quot;</span>
<span class="c"></span>    <span class="k">if</span> <span class="o">(</span><span class="nx">UA</span><span class="o">.</span><span class="nx">webkit</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">Y</span><span class="o">.</span><span class="nx">Dom</span><span class="o">[</span><span class="nx">GET_COMPUTED_STYLE</span><span class="o">]</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">att</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">var</span> <span class="nx">val</span> <span class="o">=</span> <span class="nx">_getComputedStyle</span><span class="o">(</span><span class="nx">node</span><span class="o">,</span> <span class="nx">att</span><span class="o">);</span>

            <span class="k">if</span> <span class="o">(</span><span class="nx">val</span> <span class="o">===</span> <span class="s1">&#39;rgba(0, 0, 0, 0)&#39;</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">val</span> <span class="o">=</span> <span class="s1">&#39;transparent&#39;</span><span class="o">;</span> 
            <span class="o">}</span>

            <span class="k">return</span> <span class="nx">val</span><span class="o">;</span>
        <span class="o">};</span>

    <span class="o">}</span>
<span class="o">})();</span>
</pre></div>
                    </div>
			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div id="moduleList" class="module">
                        <h4>Modules</h4>
                        <ul class="content">
                                <li class=""><a href="module_animation.html" title="animation">animation</a></li>
                                <li class=""><a href="module_autocomplete.html" title="autocomplete">autocomplete</a></li>
                                <li class=""><a href="module_button.html" title="button">button</a></li>
                                <li class=""><a href="module_calendar.html" title="calendar">calendar</a></li>
                                <li class=""><a href="module_carousel.html" title="carousel">carousel</a></li>
                                <li class=""><a href="module_charts.html" title="charts">charts</a></li>
                                <li class=""><a href="module_colorpicker.html" title="colorpicker">colorpicker</a></li>
                                <li class=""><a href="module_connection.html" title="connection">connection</a></li>
                                <li class=""><a href="module_container.html" title="container">container</a></li>
                                <li class=""><a href="module_cookie.html" title="cookie">cookie</a></li>
                                <li class=""><a href="module_datasource.html" title="datasource">datasource</a></li>
                                <li class=""><a href="module_datatable.html" title="datatable">datatable</a></li>
                                <li class="selected"><a href="module_dom.html" title="dom">dom</a></li>
                                <li class=""><a href="module_dragdrop.html" title="dragdrop">dragdrop</a></li>
                                <li class=""><a href="module_editor.html" title="editor">editor</a></li>
                                <li class=""><a href="module_element.html" title="element">element</a></li>
                                <li class=""><a href="module_event.html" title="event">event</a></li>
                                <li class=""><a href="module_get.html" title="get">get</a></li>
                                <li class=""><a href="module_history.html" title="history">history</a></li>
                                <li class=""><a href="module_imagecropper.html" title="imagecropper">imagecropper</a></li>
                                <li class=""><a href="module_imageloader.html" title="imageloader">imageloader</a></li>
                                <li class=""><a href="module_json.html" title="json">json</a></li>
                                <li class=""><a href="module_layout.html" title="layout">layout</a></li>
                                <li class=""><a href="module_logger.html" title="logger">logger</a></li>
                                <li class=""><a href="module_menu.html" title="menu">menu</a></li>
                                <li class=""><a href="module_paginator.html" title="paginator">paginator</a></li>
                                <li class=""><a href="module_profiler.html" title="profiler">profiler</a></li>
                                <li class=""><a href="module_profilerviewer.html" title="profilerviewer">profilerviewer</a></li>
                                <li class=""><a href="module_resize.html" title="resize">resize</a></li>
                                <li class=""><a href="module_selector.html" title="selector">selector</a></li>
                                <li class=""><a href="module_slider.html" title="slider">slider</a></li>
                                <li class=""><a href="module_stylesheet.html" title="stylesheet">stylesheet</a></li>
                                <li class=""><a href="module_tabview.html" title="tabview">tabview</a></li>
                                <li class=""><a href="module_treeview.html" title="treeview">treeview</a></li>
                                <li class=""><a href="module_uploader.html" title="uploader">uploader</a></li>
                                <li class=""><a href="module_yahoo.html" title="yahoo">yahoo</a></li>
                                <li class=""><a href="module_yuiloader.html" title="yuiloader">yuiloader</a></li>
                                <li class=""><a href="module_yuitest.html" title="yuitest">yuitest</a></li>
                        </ul>
                    </div>

                    <div id="classList" class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="YAHOO.util.Dom.html" title="YAHOO.util.Dom">YAHOO.util.Dom</a></li>
                                <li class=""><a href="YAHOO.util.Point.html" title="YAHOO.util.Point">YAHOO.util.Point</a></li>
                                <li class=""><a href="YAHOO.util.Region.html" title="YAHOO.util.Region">YAHOO.util.Region</a></li>
                        </ul>
                    </div>

                    <div id="fileList" class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class=""><a href="Color.js.html" title="Color.js">Color.js</a></li>
                                <li class="selected"><a href="Dom.js.html" title="Dom.js">Dom.js</a></li>
                                <li class=""><a href="IEStyle.js.html" title="IEStyle.js">IEStyle.js</a></li>
                                <li class=""><a href="Region.js.html" title="Region.js">Region.js</a></li>
                        </ul>
                    </div>





            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2009 Yahoo! Inc. All rights reserved.
	</div>
</div>
<script type="text/javascript">
    ALL_YUI_PROPS = [{"access": "", "host": "YAHOO.util.Region", "name": "0", "url": "YAHOO.util.Region.html#property_0", "type": "property"}, {"access": "", "host": "YAHOO.util.Region", "name": "1", "url": "YAHOO.util.Region.html#property_1", "type": "property"}, {"access": "", "host": "YAHOO.util.Dom", "name": "addClass", "url": "YAHOO.util.Dom.html#method_addClass", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "batch", "url": "YAHOO.util.Dom.html#method_batch", "type": "method"}, {"access": "", "host": "YAHOO.util.Region", "name": "bottom", "url": "YAHOO.util.Region.html#property_bottom", "type": "property"}, {"access": "", "host": "YAHOO.util.Region", "name": "contains", "url": "YAHOO.util.Region.html#method_contains", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "generateId", "url": "YAHOO.util.Dom.html#method_generateId", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "get", "url": "YAHOO.util.Dom.html#method_get", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getAncestorBy", "url": "YAHOO.util.Dom.html#method_getAncestorBy", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getAncestorByClassName", "url": "YAHOO.util.Dom.html#method_getAncestorByClassName", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getAncestorByTagName", "url": "YAHOO.util.Dom.html#method_getAncestorByTagName", "type": "method"}, {"access": "", "host": "YAHOO.util.Region", "name": "getArea", "url": "YAHOO.util.Region.html#method_getArea", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getAttibute", "url": "YAHOO.util.Dom.html#method_getAttibute", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getChildren", "url": "YAHOO.util.Dom.html#method_getChildren", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getChildrenBy", "url": "YAHOO.util.Dom.html#method_getChildrenBy", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getClientHeight", "url": "YAHOO.util.Dom.html#method_getClientHeight", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getClientRegion", "url": "YAHOO.util.Dom.html#method_getClientRegion", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getClientWidth", "url": "YAHOO.util.Dom.html#method_getClientWidth", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getDocumentHeight", "url": "YAHOO.util.Dom.html#method_getDocumentHeight", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getDocumentScrollLeft", "url": "YAHOO.util.Dom.html#method_getDocumentScrollLeft", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getDocumentScrollTop", "url": "YAHOO.util.Dom.html#method_getDocumentScrollTop", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getDocumentWidth", "url": "YAHOO.util.Dom.html#method_getDocumentWidth", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getElementBy", "url": "YAHOO.util.Dom.html#method_getElementBy", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getElementsBy", "url": "YAHOO.util.Dom.html#method_getElementsBy", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getElementsByClassName", "url": "YAHOO.util.Dom.html#method_getElementsByClassName", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getFirstChild", "url": "YAHOO.util.Dom.html#method_getFirstChild", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getFirstChildBy", "url": "YAHOO.util.Dom.html#method_getFirstChildBy", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getLastChild", "url": "YAHOO.util.Dom.html#method_getLastChild", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getLastChildBy", "url": "YAHOO.util.Dom.html#method_getLastChildBy", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getNextSibling", "url": "YAHOO.util.Dom.html#method_getNextSibling", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getNextSiblingBy", "url": "YAHOO.util.Dom.html#method_getNextSiblingBy", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getPreviousSibling", "url": "YAHOO.util.Dom.html#method_getPreviousSibling", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getPreviousSiblingBy", "url": "YAHOO.util.Dom.html#method_getPreviousSiblingBy", "type": "method"}, {"access": "", "host": "YAHOO.util.Region", "name": "getRegion", "url": "YAHOO.util.Region.html#method_getRegion", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getRegion", "url": "YAHOO.util.Dom.html#method_getRegion", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getStyle", "url": "YAHOO.util.Dom.html#method_getStyle", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getViewportHeight", "url": "YAHOO.util.Dom.html#method_getViewportHeight", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getViewportWidth", "url": "YAHOO.util.Dom.html#method_getViewportWidth", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getX", "url": "YAHOO.util.Dom.html#method_getX", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getXY", "url": "YAHOO.util.Dom.html#method_getXY", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "getY", "url": "YAHOO.util.Dom.html#method_getY", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "hasClass", "url": "YAHOO.util.Dom.html#method_hasClass", "type": "method"}, {"access": "", "host": "YAHOO.util.Region", "name": "height", "url": "YAHOO.util.Region.html#property_height", "type": "property"}, {"access": "", "host": "YAHOO.util.Dom", "name": "inDocument", "url": "YAHOO.util.Dom.html#method_inDocument", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "insertAfter", "url": "YAHOO.util.Dom.html#method_insertAfter", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "insertBefore", "url": "YAHOO.util.Dom.html#method_insertBefore", "type": "method"}, {"access": "", "host": "YAHOO.util.Region", "name": "intersect", "url": "YAHOO.util.Region.html#method_intersect", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "isAncestor", "url": "YAHOO.util.Dom.html#method_isAncestor", "type": "method"}, {"access": "", "host": "YAHOO.util.Region", "name": "left", "url": "YAHOO.util.Region.html#property_left", "type": "property"}, {"access": "", "host": "YAHOO.util.Dom", "name": "removeClass", "url": "YAHOO.util.Dom.html#method_removeClass", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "replaceClass", "url": "YAHOO.util.Dom.html#method_replaceClass", "type": "method"}, {"access": "", "host": "YAHOO.util.Region", "name": "right", "url": "YAHOO.util.Region.html#property_right", "type": "property"}, {"access": "", "host": "YAHOO.util.Dom", "name": "setAttibute", "url": "YAHOO.util.Dom.html#method_setAttibute", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "setStyle", "url": "YAHOO.util.Dom.html#method_setStyle", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "setX", "url": "YAHOO.util.Dom.html#method_setX", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "setXY", "url": "YAHOO.util.Dom.html#method_setXY", "type": "method"}, {"access": "", "host": "YAHOO.util.Dom", "name": "setY", "url": "YAHOO.util.Dom.html#method_setY", "type": "method"}, {"access": "", "host": "YAHOO.util.Region", "name": "top", "url": "YAHOO.util.Region.html#property_top", "type": "property"}, {"access": "", "host": "YAHOO.util.Region", "name": "toString", "url": "YAHOO.util.Region.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.util.Region", "name": "union", "url": "YAHOO.util.Region.html#method_union", "type": "method"}, {"access": "", "host": "YAHOO.util.Region", "name": "width", "url": "YAHOO.util.Region.html#property_width", "type": "property"}, {"access": "", "host": "YAHOO.util.Region", "name": "x", "url": "YAHOO.util.Region.html#property_x", "type": "property"}, {"access": "", "host": "YAHOO.util.Region", "name": "y", "url": "YAHOO.util.Region.html#property_y", "type": "property"}];
</script>
</body>
</html>
